1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 ################################################################################
4 #
5 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
6 # controllers with PCI-Express interface.
7 #
8 # Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
9 #
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by the Free
12 # Software Foundation; either version 2 of the License, or (at your option)
13 # any later version.
14 #
15 # This program is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 # more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # this program; if not, see <http://www.gnu.org/licenses/>.
22 #
23 # Author:
24 # Realtek NIC software team <nicfae@realtek.com>
25 # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
26 #
27 ################################################################################
28 */
29
30 /************************************************************************************
31 * This product is covered by one or more of the following patents:
32 * US6,570,884, US6,115,776, and US6,327,625.
33 ***********************************************************************************/
34
35 /*
36 * This driver is modified from r8169.c in Linux kernel 2.6.18
37 */
38
39 /* In Linux 5.4 asm_inline was introduced, but it's not supported by clang.
40 * Redefine it to just asm to enable successful compilation.
41 */
42
43 #include <linux/module.h>
44 #include <linux/version.h>
45 #include <linux/pci.h>
46 #include <linux/netdevice.h>
47 #include <linux/etherdevice.h>
48 #include <linux/delay.h>
49 #include <linux/mii.h>
50 #include <linux/if_vlan.h>
51 #include <linux/crc32.h>
52 #include <linux/interrupt.h>
53 #include <linux/in.h>
54 #include <linux/ip.h>
55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
56 #include <linux/ipv6.h>
57 #include <net/ip6_checksum.h>
58 #endif
59 #include <linux/tcp.h>
60 #include <linux/init.h>
61 #include <linux/rtnetlink.h>
62 #include <linux/completion.h>
63
64 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
65 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
66 #include <linux/pci-aspm.h>
67 #endif
68 #endif
69 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37)
70 #include <linux/prefetch.h>
71 #endif
72
73 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
74 #define dev_printk(A,B,fmt,args...) printk(A fmt,##args)
75 #else
76 #include <linux/dma-mapping.h>
77 #include <linux/moduleparam.h>
78 #endif
79
80 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
81 #include <linux/mdio.h>
82 #endif
83
84 #include <asm/io.h>
85 #include <asm/irq.h>
86
87 #include "r8168.h"
88 #include "r8168_asf.h"
89 #include "rtl_eeprom.h"
90 #include "rtltool.h"
91 #include "r8168_firmware.h"
92
93 #ifdef ENABLE_R8168_PROCFS
94 #include <linux/proc_fs.h>
95 #include <linux/seq_file.h>
96 #endif
97
98 #define FIRMWARE_8168D_1 "rtl_nic/rtl8168d-1.fw"
99 #define FIRMWARE_8168D_2 "rtl_nic/rtl8168d-2.fw"
100 #define FIRMWARE_8168E_1 "rtl_nic/rtl8168e-1.fw"
101 #define FIRMWARE_8168E_2 "rtl_nic/rtl8168e-2.fw"
102 #define FIRMWARE_8168E_3 "rtl_nic/rtl8168e-3.fw"
103 #define FIRMWARE_8168E_4 "rtl_nic/rtl8168e-4.fw"
104 #define FIRMWARE_8168F_1 "rtl_nic/rtl8168f-1.fw"
105 #define FIRMWARE_8168F_2 "rtl_nic/rtl8168f-2.fw"
106 #define FIRMWARE_8411_1 "rtl_nic/rtl8411-1.fw"
107 #define FIRMWARE_8411_2 "rtl_nic/rtl8411-2.fw"
108 #define FIRMWARE_8168G_2 "rtl_nic/rtl8168g-2.fw"
109 #define FIRMWARE_8168G_3 "rtl_nic/rtl8168g-3.fw"
110 #define FIRMWARE_8168EP_1 "rtl_nic/rtl8168ep-1.fw"
111 #define FIRMWARE_8168EP_2 "rtl_nic/rtl8168ep-2.fw"
112 #define FIRMWARE_8168EP_3 "rtl_nic/rtl8168ep-3.fw"
113 #define FIRMWARE_8168H_1 "rtl_nic/rtl8168h-1.fw"
114 #define FIRMWARE_8168H_2 "rtl_nic/rtl8168h-2.fw"
115 #define FIRMWARE_8168FP_3 "rtl_nic/rtl8168fp-3.fw"
116 #define FIRMWARE_8168FP_4 "rtl_nic/rtl8168fp-4.fw"
117
118 /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
119 The RTL chips use a 64 element hash table based on the Ethernet CRC. */
120 static const int multicast_filter_limit = 32;
121
122 static const struct {
123 const char *name;
124 const char *fw_name;
125 } rtl_chip_fw_infos[] = {
126 /* PCI-E devices. */
127 [CFG_METHOD_1] = {"RTL8168B/8111", },
128 [CFG_METHOD_2] = {"RTL8168B/8111", },
129 [CFG_METHOD_3] = {"RTL8168B/8111", },
130 [CFG_METHOD_4] = {"RTL8168C/8111C", },
131 [CFG_METHOD_5] = {"RTL8168C/8111C", },
132 [CFG_METHOD_6] = {"RTL8168C/8111C", },
133 [CFG_METHOD_7] = {"RTL8168CP/8111CP", },
134 [CFG_METHOD_8] = {"RTL8168CP/8111CP", },
135 [CFG_METHOD_9] = {"RTL8168D/8111D", FIRMWARE_8168D_1},
136 [CFG_METHOD_10] = {"RTL8168D/8111D", FIRMWARE_8168D_2},
137 [CFG_METHOD_11] = {"RTL8168DP/8111DP", },
138 [CFG_METHOD_12] = {"RTL8168DP/8111DP", },
139 [CFG_METHOD_13] = {"RTL8168DP/8111DP", },
140 [CFG_METHOD_14] = {"RTL8168E/8111E", FIRMWARE_8168E_1},
141 [CFG_METHOD_15] = {"RTL8168E/8111E", FIRMWARE_8168E_2},
142 [CFG_METHOD_16] = {"RTL8168E-VL/8111E-VL", FIRMWARE_8168E_3},
143 [CFG_METHOD_17] = {"RTL8168E-VL/8111E-VL", FIRMWARE_8168E_4},
144 [CFG_METHOD_18] = {"RTL8168F/8111F", FIRMWARE_8168F_1},
145 [CFG_METHOD_19] = {"RTL8168F/8111F", FIRMWARE_8168F_2},
146 [CFG_METHOD_20] = {"RTL8411", FIRMWARE_8411_1},
147 [CFG_METHOD_21] = {"RTL8168G/8111G", FIRMWARE_8168G_2},
148 [CFG_METHOD_22] = {"RTL8168G/8111G", },
149 [CFG_METHOD_23] = {"RTL8168EP/8111EP", FIRMWARE_8168EP_1},
150 [CFG_METHOD_24] = {"RTL8168GU/8111GU", },
151 [CFG_METHOD_25] = {"RTL8168GU/8111GU", FIRMWARE_8168G_3},
152 [CFG_METHOD_26] = {"8411B", FIRMWARE_8411_2},
153 [CFG_METHOD_27] = {"RTL8168EP/8111EP", FIRMWARE_8168EP_2},
154 [CFG_METHOD_28] = {"RTL8168EP/8111EP", FIRMWARE_8168EP_3},
155 [CFG_METHOD_29] = {"RTL8168H/8111H", FIRMWARE_8168H_1},
156 [CFG_METHOD_30] = {"RTL8168H/8111H", FIRMWARE_8168H_2},
157 [CFG_METHOD_31] = {"RTL8168FP/8111FP", },
158 [CFG_METHOD_32] = {"RTL8168FP/8111FP", FIRMWARE_8168FP_3},
159 [CFG_METHOD_33] = {"RTL8168FP/8111FP", FIRMWARE_8168FP_4},
160 [CFG_METHOD_DEFAULT] = {"Unknown", },
161 };
162
163 #define _R(NAME,MAC,RCR,MASK, JumFrameSz) \
164 { .name = NAME, .mcfg = MAC, .RCR_Cfg = RCR, .RxConfigMask = MASK, .jumbo_frame_sz = JumFrameSz }
165
166 static const struct {
167 const char *name;
168 u8 mcfg;
169 u32 RCR_Cfg;
170 u32 RxConfigMask; /* Clears the bits supported by this chip */
171 u32 jumbo_frame_sz;
172 } rtl_chip_info[] = {
173 _R("RTL8168B/8111B",
174 CFG_METHOD_1,
175 (Reserved2_data << Reserved2_shift) | (RX_DMA_BURST << RxCfgDMAShift),
176 0xff7e1880,
177 Jumbo_Frame_4k),
178
179 _R("RTL8168B/8111B",
180 CFG_METHOD_2,
181 (Reserved2_data << Reserved2_shift) | (RX_DMA_BURST << RxCfgDMAShift),
182 0xff7e1880,
183 Jumbo_Frame_4k),
184
185 _R("RTL8168B/8111B",
186 CFG_METHOD_3,
187 (Reserved2_data << Reserved2_shift) | (RX_DMA_BURST << RxCfgDMAShift),
188 0xff7e1880,
189 Jumbo_Frame_4k),
190
191 _R("RTL8168C/8111C",
192 CFG_METHOD_4,
193 RxCfg_128_int_en | RxCfg_fet_multi_en | (RX_DMA_BURST << RxCfgDMAShift),
194 0xff7e1880,
195 Jumbo_Frame_6k),
196
197 _R("RTL8168C/8111C",
198 CFG_METHOD_5,
199 RxCfg_128_int_en | RxCfg_fet_multi_en | (RX_DMA_BURST << RxCfgDMAShift),
200 0xff7e1880,
201 Jumbo_Frame_6k),
202
203 _R("RTL8168C/8111C",
204 CFG_METHOD_6,
205 RxCfg_128_int_en | RxCfg_fet_multi_en | (RX_DMA_BURST << RxCfgDMAShift),
206 0xff7e1880,
207 Jumbo_Frame_6k),
208
209 _R("RTL8168CP/8111CP",
210 CFG_METHOD_7,
211 RxCfg_128_int_en | RxCfg_fet_multi_en | (RX_DMA_BURST << RxCfgDMAShift),
212 0xff7e1880,
213 Jumbo_Frame_6k),
214
215 _R("RTL8168CP/8111CP",
216 CFG_METHOD_8,
217 RxCfg_128_int_en | RxCfg_fet_multi_en | (RX_DMA_BURST << RxCfgDMAShift),
218 0xff7e1880,
219 Jumbo_Frame_6k),
220
221 _R("RTL8168D/8111D",
222 CFG_METHOD_9,
223 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
224 0xff7e1880,
225 Jumbo_Frame_9k),
226
227 _R("RTL8168D/8111D",
228 CFG_METHOD_10,
229 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
230 0xff7e1880,
231 Jumbo_Frame_9k),
232
233 _R("RTL8168DP/8111DP",
234 CFG_METHOD_11,
235 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
236 0xff7e1880,
237 Jumbo_Frame_9k),
238
239 _R("RTL8168DP/8111DP",
240 CFG_METHOD_12,
241 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
242 0xff7e1880,
243 Jumbo_Frame_9k),
244
245 _R("RTL8168DP/8111DP",
246 CFG_METHOD_13,
247 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
248 0xff7e1880,
249 Jumbo_Frame_9k),
250
251 _R("RTL8168E/8111E",
252 CFG_METHOD_14,
253 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
254 0xff7e1880,
255 Jumbo_Frame_9k),
256
257 _R("RTL8168E/8111E",
258 CFG_METHOD_15,
259 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
260 0xff7e1880,
261 Jumbo_Frame_9k),
262
263 _R("RTL8168E-VL/8111E-VL",
264 CFG_METHOD_16,
265 RxCfg_128_int_en | RxEarly_off_V1 | (RX_DMA_BURST << RxCfgDMAShift),
266 0xff7e0080,
267 Jumbo_Frame_9k),
268
269 _R("RTL8168E-VL/8111E-VL",
270 CFG_METHOD_17,
271 RxCfg_128_int_en | RxEarly_off_V1 | (RX_DMA_BURST << RxCfgDMAShift),
272 0xff7e1880,
273 Jumbo_Frame_9k),
274
275 _R("RTL8168F/8111F",
276 CFG_METHOD_18,
277 RxCfg_128_int_en | RxEarly_off_V1 | (RX_DMA_BURST << RxCfgDMAShift),
278 0xff7e1880,
279 Jumbo_Frame_9k),
280
281 _R("RTL8168F/8111F",
282 CFG_METHOD_19,
283 RxCfg_128_int_en | RxEarly_off_V1 | (RX_DMA_BURST << RxCfgDMAShift),
284 0xff7e1880,
285 Jumbo_Frame_9k),
286
287 _R("RTL8411",
288 CFG_METHOD_20,
289 RxCfg_128_int_en | (RX_DMA_BURST << RxCfgDMAShift),
290 0xff7e1880,
291 Jumbo_Frame_9k),
292
293 _R("RTL8168G/8111G",
294 CFG_METHOD_21,
295 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
296 0xff7e5880,
297 Jumbo_Frame_9k),
298
299 _R("RTL8168G/8111G",
300 CFG_METHOD_22,
301 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
302 0xff7e5880,
303 Jumbo_Frame_9k),
304
305 _R("RTL8168EP/8111EP",
306 CFG_METHOD_23,
307 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
308 0xff7e5880,
309 Jumbo_Frame_9k),
310
311 _R("RTL8168GU/8111GU",
312 CFG_METHOD_24,
313 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
314 0xff7e5880,
315 Jumbo_Frame_9k),
316
317 _R("RTL8168GU/8111GU",
318 CFG_METHOD_25,
319 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
320 0xff7e5880,
321 Jumbo_Frame_9k),
322
323 _R("8411B",
324 CFG_METHOD_26,
325 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
326 0xff7e5880,
327 Jumbo_Frame_9k),
328
329 _R("RTL8168EP/8111EP",
330 CFG_METHOD_27,
331 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
332 0xff7e5880,
333 Jumbo_Frame_9k),
334
335 _R("RTL8168EP/8111EP",
336 CFG_METHOD_28,
337 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
338 0xff7e5880,
339 Jumbo_Frame_9k),
340
341 _R("RTL8168H/8111H",
342 CFG_METHOD_29,
343 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
344 0xff7e5880,
345 Jumbo_Frame_9k),
346
347 _R("RTL8168H/8111H",
348 CFG_METHOD_30,
349 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
350 0xff7e5880,
351 Jumbo_Frame_9k),
352
353 _R("RTL8168FP/8111FP",
354 CFG_METHOD_31,
355 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
356 0xff7e5880,
357 Jumbo_Frame_9k),
358
359 _R("RTL8168FP/8111FP",
360 CFG_METHOD_32,
361 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
362 0xff7e5880,
363 Jumbo_Frame_9k),
364
365 _R("RTL8168FP/8111FP",
366 CFG_METHOD_33,
367 RxCfg_128_int_en | RxEarly_off_V2 | Rx_Single_fetch_V2 | (RX_DMA_BURST << RxCfgDMAShift),
368 0xff7e5880,
369 Jumbo_Frame_9k),
370
371 _R("Unknown",
372 CFG_METHOD_DEFAULT,
373 (RX_DMA_BURST << RxCfgDMAShift),
374 0xff7e5880,
375 Jumbo_Frame_1k)
376 };
377 #undef _R
378
379 #ifndef PCI_VENDOR_ID_DLINK
380 #define PCI_VENDOR_ID_DLINK 0x1186
381 #endif
382
383 static struct pci_device_id rtl8168_pci_tbl[] = {
384 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), },
385 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), },
386 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x2502), },
387 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x2600), },
388 { PCI_VENDOR_ID_DLINK, 0x4300, 0x1186, 0x4b10,},
389 {0,},
390 };
391
392 MODULE_DEVICE_TABLE(pci, rtl8168_pci_tbl);
393
394 static int rx_copybreak = 0;
395 static int use_dac = 1;
396 static int timer_count = 0x2600;
397 static int dynamic_aspm_packet_threshold = 10;
398
399 static struct {
400 u32 msg_enable;
401 } debug = { -1 };
402
403 static unsigned int speed_mode = SPEED_1000;
404 static unsigned int duplex_mode = DUPLEX_FULL;
405 static unsigned int autoneg_mode = AUTONEG_ENABLE;
406 static unsigned int advertising_mode = ADVERTISED_10baseT_Half |
407 ADVERTISED_10baseT_Full |
408 ADVERTISED_100baseT_Half |
409 ADVERTISED_100baseT_Full |
410 ADVERTISED_1000baseT_Half |
411 ADVERTISED_1000baseT_Full;
412 #ifdef CONFIG_ASPM
413 static int aspm = 1;
414 #else
415 static int aspm = 0;
416 #endif
417 #ifdef CONFIG_DYNAMIC_ASPM
418 static int dynamic_aspm = 1;
419 #else
420 static int dynamic_aspm = 0;
421 #endif
422 #ifdef ENABLE_S5WOL
423 static int s5wol = 1;
424 #else
425 static int s5wol = 0;
426 #endif
427 #ifdef ENABLE_S5_KEEP_CURR_MAC
428 static int s5_keep_curr_mac = 1;
429 #else
430 static int s5_keep_curr_mac = 0;
431 #endif
432 #ifdef ENABLE_EEE
433 static int eee_enable = 1;
434 #else
435 static int eee_enable = 0;
436 #endif
437 #ifdef CONFIG_SOC_LAN
438 static ulong hwoptimize = HW_PATCH_SOC_LAN;
439 #else
440 static ulong hwoptimize = 0;
441 #endif
442 #ifdef ENABLE_S0_MAGIC_PACKET
443 static int s0_magic_packet = 1;
444 #else
445 static int s0_magic_packet = 0;
446 #endif
447
448 MODULE_AUTHOR("Realtek and the Linux r8168 crew <netdev@vger.kernel.org>");
449 MODULE_DESCRIPTION("RealTek RTL-8168 Gigabit Ethernet driver");
450
451 module_param(speed_mode, uint, 0);
452 MODULE_PARM_DESC(speed_mode, "force phy operation. Deprecated by ethtool (8).");
453
454 module_param(duplex_mode, uint, 0);
455 MODULE_PARM_DESC(duplex_mode, "force phy operation. Deprecated by ethtool (8).");
456
457 module_param(autoneg_mode, uint, 0);
458 MODULE_PARM_DESC(autoneg_mode, "force phy operation. Deprecated by ethtool (8).");
459
460 module_param(advertising_mode, uint, 0);
461 MODULE_PARM_DESC(advertising_mode, "force phy operation. Deprecated by ethtool (8).");
462
463 module_param(aspm, int, 0);
464 MODULE_PARM_DESC(aspm, "Enable ASPM.");
465
466 module_param(dynamic_aspm, int, 0);
467 MODULE_PARM_DESC(aspm, "Enable Software Dynamic ASPM.");
468
469 module_param(s5wol, int, 0);
470 MODULE_PARM_DESC(s5wol, "Enable Shutdown Wake On Lan.");
471
472 module_param(s5_keep_curr_mac, int, 0);
473 MODULE_PARM_DESC(s5_keep_curr_mac, "Enable Shutdown Keep Current MAC Address.");
474
475 module_param(rx_copybreak, int, 0);
476 MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
477
478 module_param(use_dac, int, 0);
479 MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot.");
480
481 module_param(timer_count, int, 0);
482 MODULE_PARM_DESC(timer_count, "Timer Interrupt Interval.");
483
484 module_param(eee_enable, int, 0);
485 MODULE_PARM_DESC(eee_enable, "Enable Energy Efficient Ethernet.");
486
487 module_param(hwoptimize, ulong, 0);
488 MODULE_PARM_DESC(hwoptimize, "Enable HW optimization function.");
489
490 module_param(s0_magic_packet, int, 0);
491 MODULE_PARM_DESC(s0_magic_packet, "Enable S0 Magic Packet.");
492
493 module_param(dynamic_aspm_packet_threshold, int, 0);
494 MODULE_PARM_DESC(dynamic_aspm_packet_threshold, "Dynamic ASPM packet threshold.");
495
496 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
497 module_param_named(debug, debug.msg_enable, int, 0);
498 MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)");
499 #endif//LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
500
501 MODULE_LICENSE("GPL");
502 #ifdef ENABLE_USE_FIRMWARE_FILE
503 MODULE_FIRMWARE(FIRMWARE_8168D_1);
504 MODULE_FIRMWARE(FIRMWARE_8168D_2);
505 MODULE_FIRMWARE(FIRMWARE_8168E_1);
506 MODULE_FIRMWARE(FIRMWARE_8168E_2);
507 MODULE_FIRMWARE(FIRMWARE_8168E_3);
508 MODULE_FIRMWARE(FIRMWARE_8168E_4);
509 MODULE_FIRMWARE(FIRMWARE_8168F_1);
510 MODULE_FIRMWARE(FIRMWARE_8168F_2);
511 MODULE_FIRMWARE(FIRMWARE_8411_1);
512 MODULE_FIRMWARE(FIRMWARE_8411_2);
513 MODULE_FIRMWARE(FIRMWARE_8168G_2);
514 MODULE_FIRMWARE(FIRMWARE_8168G_3);
515 MODULE_FIRMWARE(FIRMWARE_8168EP_1);
516 MODULE_FIRMWARE(FIRMWARE_8168EP_2);
517 MODULE_FIRMWARE(FIRMWARE_8168EP_3);
518 MODULE_FIRMWARE(FIRMWARE_8168H_1);
519 MODULE_FIRMWARE(FIRMWARE_8168H_2);
520 MODULE_FIRMWARE(FIRMWARE_8168FP_3);
521 MODULE_FIRMWARE(FIRMWARE_8168FP_4);
522 #endif
523
524 MODULE_VERSION(RTL8168_VERSION);
525
526 static void rtl8168_sleep_rx_enable(struct net_device *dev);
527 static void rtl8168_dsm(struct net_device *dev, int dev_state);
528
529 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
530 static void rtl8168_esd_timer(unsigned long __opaque);
531 #else
532 static void rtl8168_esd_timer(struct timer_list *t);
533 #endif
534 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
535 static void rtl8168_link_timer(unsigned long __opaque);
536 #else
537 static void rtl8168_link_timer(struct timer_list *t);
538 #endif
539 static void rtl8168_tx_clear(struct rtl8168_private *tp);
540 static void rtl8168_rx_clear(struct rtl8168_private *tp);
541
542 static int rtl8168_open(struct net_device *dev);
543 static netdev_tx_t rtl8168_start_xmit(struct sk_buff *skb, struct net_device *dev);
544 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
545 static irqreturn_t rtl8168_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
546 #else
547 static irqreturn_t rtl8168_interrupt(int irq, void *dev_instance);
548 #endif
549 static void rtl8168_rx_desc_offset0_init(struct rtl8168_private *, int);
550 static int rtl8168_init_ring(struct net_device *dev);
551 static void rtl8168_hw_config(struct net_device *dev);
552 static void rtl8168_hw_start(struct net_device *dev);
553 static int rtl8168_close(struct net_device *dev);
554 static void rtl8168_set_rx_mode(struct net_device *dev);
555 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
556 static void rtl8168_tx_timeout(struct net_device *dev, unsigned int txqueue);
557 #else
558 static void rtl8168_tx_timeout(struct net_device *dev);
559 #endif
560 static struct net_device_stats *rtl8168_get_stats(struct net_device *dev);
561 static int rtl8168_rx_interrupt(struct net_device *, struct rtl8168_private *, napi_budget);
562 static int rtl8168_change_mtu(struct net_device *dev, int new_mtu);
563 static void rtl8168_down(struct net_device *dev);
564
565 static int rtl8168_set_mac_address(struct net_device *dev, void *p);
566 void rtl8168_rar_set(struct rtl8168_private *tp, uint8_t *addr);
567 static void rtl8168_desc_addr_fill(struct rtl8168_private *);
568 static void rtl8168_tx_desc_init(struct rtl8168_private *tp);
569 static void rtl8168_rx_desc_init(struct rtl8168_private *tp);
570
571 static u16 rtl8168_get_hw_phy_mcu_code_ver(struct rtl8168_private *tp);
572
573 static void rtl8168_hw_reset(struct net_device *dev);
574
575 static void rtl8168_phy_power_up(struct net_device *dev);
576 static void rtl8168_phy_power_down(struct net_device *dev);
577 static int rtl8168_set_speed(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, u32 adv);
578
579 static int rtl8168_set_phy_mcu_patch_request(struct rtl8168_private *tp);
580 static int rtl8168_clear_phy_mcu_patch_request(struct rtl8168_private *tp);
581
582 #ifdef CONFIG_R8168_NAPI
583 static int rtl8168_poll(napi_ptr napi, napi_budget budget);
584 #endif
585
586 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
587 static void rtl8168_reset_task(void *_data);
588 #else
589 static void rtl8168_reset_task(struct work_struct *work);
590 #endif
591
tp_to_dev(struct rtl8168_private * tp)592 static inline struct device *tp_to_dev(struct rtl8168_private *tp)
593 {
594 return &tp->pci_dev->dev;
595 }
596
597 #if ((LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) && \
598 LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,00)))
ethtool_convert_legacy_u32_to_link_mode(unsigned long * dst,u32 legacy_u32)599 void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
600 u32 legacy_u32)
601 {
602 bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
603 dst[0] = legacy_u32;
604 }
605
ethtool_convert_link_mode_to_legacy_u32(u32 * legacy_u32,const unsigned long * src)606 bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
607 const unsigned long *src)
608 {
609 bool retval = true;
610
611 /* TODO: following test will soon always be true */
612 if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
613 __ETHTOOL_DECLARE_LINK_MODE_MASK(ext);
614
615 bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
616 bitmap_fill(ext, 32);
617 bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
618 if (bitmap_intersects(ext, src,
619 __ETHTOOL_LINK_MODE_MASK_NBITS)) {
620 /* src mask goes beyond bit 31 */
621 retval = false;
622 }
623 }
624 *legacy_u32 = src[0];
625 return retval;
626 }
627 #endif
628
629 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
630
631 #ifndef LPA_1000FULL
632 #define LPA_1000FULL 0x0800
633 #endif
634
635 #ifndef LPA_1000HALF
636 #define LPA_1000HALF 0x0400
637 #endif
638
mii_adv_to_ethtool_adv_t(u32 adv)639 static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
640 {
641 u32 result = 0;
642
643 if (adv & ADVERTISE_10HALF)
644 result |= ADVERTISED_10baseT_Half;
645 if (adv & ADVERTISE_10FULL)
646 result |= ADVERTISED_10baseT_Full;
647 if (adv & ADVERTISE_100HALF)
648 result |= ADVERTISED_100baseT_Half;
649 if (adv & ADVERTISE_100FULL)
650 result |= ADVERTISED_100baseT_Full;
651 if (adv & ADVERTISE_PAUSE_CAP)
652 result |= ADVERTISED_Pause;
653 if (adv & ADVERTISE_PAUSE_ASYM)
654 result |= ADVERTISED_Asym_Pause;
655
656 return result;
657 }
658
mii_lpa_to_ethtool_lpa_t(u32 lpa)659 static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
660 {
661 u32 result = 0;
662
663 if (lpa & LPA_LPACK)
664 result |= ADVERTISED_Autoneg;
665
666 return result | mii_adv_to_ethtool_adv_t(lpa);
667 }
668
mii_stat1000_to_ethtool_lpa_t(u32 lpa)669 static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
670 {
671 u32 result = 0;
672
673 if (lpa & LPA_1000HALF)
674 result |= ADVERTISED_1000baseT_Half;
675 if (lpa & LPA_1000FULL)
676 result |= ADVERTISED_1000baseT_Full;
677
678 return result;
679 }
680
681 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
682
683 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
eth_hw_addr_random(struct net_device * dev)684 static inline void eth_hw_addr_random(struct net_device *dev)
685 {
686 random_ether_addr(dev->dev_addr);
687 }
688 #endif
689
690 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
691 #undef ethtool_ops
692 #define ethtool_ops _kc_ethtool_ops
693
694 struct _kc_ethtool_ops {
695 int (*get_settings)(struct net_device *, struct ethtool_cmd *);
696 int (*set_settings)(struct net_device *, struct ethtool_cmd *);
697 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
698 int (*get_regs_len)(struct net_device *);
699 void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
700 void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
701 int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
702 u32 (*get_msglevel)(struct net_device *);
703 void (*set_msglevel)(struct net_device *, u32);
704 int (*nway_reset)(struct net_device *);
705 u32 (*get_link)(struct net_device *);
706 int (*get_eeprom_len)(struct net_device *);
707 int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
708 int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
709 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
710 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
711 void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
712 int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
713 void (*get_pauseparam)(struct net_device *,
714 struct ethtool_pauseparam*);
715 int (*set_pauseparam)(struct net_device *,
716 struct ethtool_pauseparam*);
717 u32 (*get_rx_csum)(struct net_device *);
718 int (*set_rx_csum)(struct net_device *, u32);
719 u32 (*get_tx_csum)(struct net_device *);
720 int (*set_tx_csum)(struct net_device *, u32);
721 u32 (*get_sg)(struct net_device *);
722 int (*set_sg)(struct net_device *, u32);
723 u32 (*get_tso)(struct net_device *);
724 int (*set_tso)(struct net_device *, u32);
725 int (*self_test_count)(struct net_device *);
726 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
727 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
728 int (*phys_id)(struct net_device *, u32);
729 int (*get_stats_count)(struct net_device *);
730 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *,
731 u64 *);
732 } *ethtool_ops = NULL;
733
734 #undef SET_ETHTOOL_OPS
735 #define SET_ETHTOOL_OPS(netdev, ops) (ethtool_ops = (ops))
736
737 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
738
739 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
740 #ifndef SET_ETHTOOL_OPS
741 #define SET_ETHTOOL_OPS(netdev,ops) \
742 ( (netdev)->ethtool_ops = (ops) )
743 #endif //SET_ETHTOOL_OPS
744 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
745
746 //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
747 #ifndef netif_msg_init
748 #define netif_msg_init _kc_netif_msg_init
749 /* copied from linux kernel 2.6.20 include/linux/netdevice.h */
netif_msg_init(int debug_value,int default_msg_enable_bits)750 static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
751 {
752 /* use default */
753 if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
754 return default_msg_enable_bits;
755 if (debug_value == 0) /* no output */
756 return 0;
757 /* set low N bits */
758 return (1 << debug_value) - 1;
759 }
760
761 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
762
763 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)
eth_copy_and_sum(struct sk_buff * dest,const unsigned char * src,int len,int base)764 static inline void eth_copy_and_sum (struct sk_buff *dest,
765 const unsigned char *src,
766 int len, int base)
767 {
768 memcpy (dest->data, src, len);
769 }
770 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)
771
772 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
773 /* copied from linux kernel 2.6.20 /include/linux/time.h */
774 /* Parameters used to convert the timespec values: */
775 #define MSEC_PER_SEC 1000L
776
777 /* copied from linux kernel 2.6.20 /include/linux/jiffies.h */
778 /*
779 * Change timeval to jiffies, trying to avoid the
780 * most obvious overflows..
781 *
782 * And some not so obvious.
783 *
784 * Note that we don't want to return MAX_LONG, because
785 * for various timeout reasons we often end up having
786 * to wait "jiffies+1" in order to guarantee that we wait
787 * at _least_ "jiffies" - so "jiffies+1" had better still
788 * be positive.
789 */
790 #define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
791
792 /*
793 * Convert jiffies to milliseconds and back.
794 *
795 * Avoid unnecessary multiplications/divisions in the
796 * two most common HZ cases:
797 */
_kc_jiffies_to_msecs(const unsigned long j)798 static inline unsigned int _kc_jiffies_to_msecs(const unsigned long j)
799 {
800 #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
801 return (MSEC_PER_SEC / HZ) * j;
802 #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
803 return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
804 #else
805 return (j * MSEC_PER_SEC) / HZ;
806 #endif
807 }
808
_kc_msecs_to_jiffies(const unsigned int m)809 static inline unsigned long _kc_msecs_to_jiffies(const unsigned int m)
810 {
811 if (m > _kc_jiffies_to_msecs(MAX_JIFFY_OFFSET))
812 return MAX_JIFFY_OFFSET;
813 #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
814 return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
815 #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
816 return m * (HZ / MSEC_PER_SEC);
817 #else
818 return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;
819 #endif
820 }
821 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
822
823
824 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
825
826 /* copied from linux kernel 2.6.12.6 /include/linux/pm.h */
827 typedef int __bitwise pci_power_t;
828
829 /* copied from linux kernel 2.6.12.6 /include/linux/pci.h */
830 typedef u32 __bitwise pm_message_t;
831
832 #define PCI_D0 ((pci_power_t __force) 0)
833 #define PCI_D1 ((pci_power_t __force) 1)
834 #define PCI_D2 ((pci_power_t __force) 2)
835 #define PCI_D3hot ((pci_power_t __force) 3)
836 #define PCI_D3cold ((pci_power_t __force) 4)
837 #define PCI_POWER_ERROR ((pci_power_t __force) -1)
838
839 /* copied from linux kernel 2.6.12.6 /drivers/pci/pci.c */
840 /**
841 * pci_choose_state - Choose the power state of a PCI device
842 * @dev: PCI device to be suspended
843 * @state: target sleep state for the whole system. This is the value
844 * that is passed to suspend() function.
845 *
846 * Returns PCI power state suitable for given device and given system
847 * message.
848 */
849
pci_choose_state(struct pci_dev * dev,pm_message_t state)850 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
851 {
852 if (!pci_find_capability(dev, PCI_CAP_ID_PM))
853 return PCI_D0;
854
855 switch (state) {
856 case 0:
857 return PCI_D0;
858 case 3:
859 return PCI_D3hot;
860 default:
861 printk("They asked me for state %d\n", state);
862 // BUG();
863 }
864 return PCI_D0;
865 }
866 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
867
868 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
869 /**
870 * msleep_interruptible - sleep waiting for waitqueue interruptions
871 * @msecs: Time in milliseconds to sleep for
872 */
873 #define msleep_interruptible _kc_msleep_interruptible
_kc_msleep_interruptible(unsigned int msecs)874 unsigned long _kc_msleep_interruptible(unsigned int msecs)
875 {
876 unsigned long timeout = _kc_msecs_to_jiffies(msecs);
877
878 while (timeout && !signal_pending(current)) {
879 set_current_state(TASK_INTERRUPTIBLE);
880 timeout = schedule_timeout(timeout);
881 }
882 return _kc_jiffies_to_msecs(timeout);
883 }
884 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
885
886 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
887 /* copied from linux kernel 2.6.20 include/linux/sched.h */
888 #ifndef __sched
889 #define __sched __attribute__((__section__(".sched.text")))
890 #endif
891
892 /* copied from linux kernel 2.6.20 kernel/timer.c */
schedule_timeout_uninterruptible(signed long timeout)893 signed long __sched schedule_timeout_uninterruptible(signed long timeout)
894 {
895 __set_current_state(TASK_UNINTERRUPTIBLE);
896 return schedule_timeout(timeout);
897 }
898
899 /* copied from linux kernel 2.6.20 include/linux/mii.h */
900 #undef if_mii
901 #define if_mii _kc_if_mii
if_mii(struct ifreq * rq)902 static inline struct mii_ioctl_data *if_mii(struct ifreq *rq)
903 {
904 return (struct mii_ioctl_data *) &rq->ifr_ifru;
905 }
906 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
907
908 struct rtl8168_counters {
909 u64 tx_packets;
910 u64 rx_packets;
911 u64 tx_errors;
912 u32 rx_errors;
913 u16 rx_missed;
914 u16 align_errors;
915 u32 tx_one_collision;
916 u32 tx_multi_collision;
917 u64 rx_unicast;
918 u64 rx_broadcast;
919 u32 rx_multicast;
920 u16 tx_aborted;
921 u16 tx_underrun;
922 };
923
924 #ifdef ENABLE_R8168_PROCFS
925 /****************************************************************************
926 * -----------------------------PROCFS STUFF-------------------------
927 *****************************************************************************
928 */
929
930 static struct proc_dir_entry *rtl8168_proc;
931 static int proc_init_num = 0;
932
933 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
proc_get_driver_variable(struct seq_file * m,void * v)934 static int proc_get_driver_variable(struct seq_file *m, void *v)
935 {
936 struct net_device *dev = m->private;
937 struct rtl8168_private *tp = netdev_priv(dev);
938 unsigned long flags;
939
940 seq_puts(m, "\nDump Driver Variable\n");
941
942 spin_lock_irqsave(&tp->lock, flags);
943 seq_puts(m, "Variable\tValue\n----------\t-----\n");
944 seq_printf(m, "MODULENAME\t%s\n", MODULENAME);
945 seq_printf(m, "driver version\t%s\n", RTL8168_VERSION);
946 seq_printf(m, "chipset\t%d\n", tp->chipset);
947 seq_printf(m, "chipset_name\t%s\n", rtl_chip_info[tp->chipset].name);
948 seq_printf(m, "mtu\t%d\n", dev->mtu);
949 seq_printf(m, "NUM_RX_DESC\t0x%x\n", NUM_RX_DESC);
950 seq_printf(m, "cur_rx\t0x%x\n", tp->cur_rx);
951 seq_printf(m, "dirty_rx\t0x%x\n", tp->dirty_rx);
952 seq_printf(m, "NUM_TX_DESC\t0x%x\n", NUM_TX_DESC);
953 seq_printf(m, "cur_tx\t0x%x\n", tp->cur_tx);
954 seq_printf(m, "dirty_tx\t0x%x\n", tp->dirty_tx);
955 seq_printf(m, "rx_buf_sz\t0x%x\n", tp->rx_buf_sz);
956 seq_printf(m, "esd_flag\t0x%x\n", tp->esd_flag);
957 seq_printf(m, "pci_cfg_is_read\t0x%x\n", tp->pci_cfg_is_read);
958 seq_printf(m, "rtl8168_rx_config\t0x%x\n", tp->rtl8168_rx_config);
959 seq_printf(m, "cp_cmd\t0x%x\n", tp->cp_cmd);
960 seq_printf(m, "intr_mask\t0x%x\n", tp->intr_mask);
961 seq_printf(m, "timer_intr_mask\t0x%x\n", tp->timer_intr_mask);
962 seq_printf(m, "wol_enabled\t0x%x\n", tp->wol_enabled);
963 seq_printf(m, "wol_opts\t0x%x\n", tp->wol_opts);
964 seq_printf(m, "efuse_ver\t0x%x\n", tp->efuse_ver);
965 seq_printf(m, "eeprom_type\t0x%x\n", tp->eeprom_type);
966 seq_printf(m, "autoneg\t0x%x\n", tp->autoneg);
967 seq_printf(m, "duplex\t0x%x\n", tp->duplex);
968 seq_printf(m, "speed\t%d\n", tp->speed);
969 seq_printf(m, "advertising\t0x%x\n", tp->advertising);
970 seq_printf(m, "eeprom_len\t0x%x\n", tp->eeprom_len);
971 seq_printf(m, "cur_page\t0x%x\n", tp->cur_page);
972 seq_printf(m, "bios_setting\t0x%x\n", tp->bios_setting);
973 seq_printf(m, "features\t0x%x\n", tp->features);
974 seq_printf(m, "org_pci_offset_99\t0x%x\n", tp->org_pci_offset_99);
975 seq_printf(m, "org_pci_offset_180\t0x%x\n", tp->org_pci_offset_180);
976 seq_printf(m, "issue_offset_99_event\t0x%x\n", tp->issue_offset_99_event);
977 seq_printf(m, "org_pci_offset_80\t0x%x\n", tp->org_pci_offset_80);
978 seq_printf(m, "org_pci_offset_81\t0x%x\n", tp->org_pci_offset_81);
979 seq_printf(m, "use_timer_interrrupt\t0x%x\n", tp->use_timer_interrrupt);
980 seq_printf(m, "HwIcVerUnknown\t0x%x\n", tp->HwIcVerUnknown);
981 seq_printf(m, "NotWrRamCodeToMicroP\t0x%x\n", tp->NotWrRamCodeToMicroP);
982 seq_printf(m, "NotWrMcuPatchCode\t0x%x\n", tp->NotWrMcuPatchCode);
983 seq_printf(m, "HwHasWrRamCodeToMicroP\t0x%x\n", tp->HwHasWrRamCodeToMicroP);
984 seq_printf(m, "sw_ram_code_ver\t0x%x\n", tp->sw_ram_code_ver);
985 seq_printf(m, "hw_ram_code_ver\t0x%x\n", tp->hw_ram_code_ver);
986 seq_printf(m, "rtk_enable_diag\t0x%x\n", tp->rtk_enable_diag);
987 seq_printf(m, "ShortPacketSwChecksum\t0x%x\n", tp->ShortPacketSwChecksum);
988 seq_printf(m, "UseSwPaddingShortPkt\t0x%x\n", tp->UseSwPaddingShortPkt);
989 seq_printf(m, "RequireAdcBiasPatch\t0x%x\n", tp->RequireAdcBiasPatch);
990 seq_printf(m, "AdcBiasPatchIoffset\t0x%x\n", tp->AdcBiasPatchIoffset);
991 seq_printf(m, "RequireAdjustUpsTxLinkPulseTiming\t0x%x\n", tp->RequireAdjustUpsTxLinkPulseTiming);
992 seq_printf(m, "SwrCnt1msIni\t0x%x\n", tp->SwrCnt1msIni);
993 seq_printf(m, "HwSuppNowIsOobVer\t0x%x\n", tp->HwSuppNowIsOobVer);
994 seq_printf(m, "HwFiberModeVer\t0x%x\n", tp->HwFiberModeVer);
995 seq_printf(m, "HwFiberStat\t0x%x\n", tp->HwFiberStat);
996 seq_printf(m, "HwSwitchMdiToFiber\t0x%x\n", tp->HwSwitchMdiToFiber);
997 seq_printf(m, "HwSuppSerDesPhyVer\t0x%x\n", tp->HwSuppSerDesPhyVer);
998 seq_printf(m, "NicCustLedValue\t0x%x\n", tp->NicCustLedValue);
999 seq_printf(m, "RequiredSecLanDonglePatch\t0x%x\n", tp->RequiredSecLanDonglePatch);
1000 seq_printf(m, "HwSuppDashVer\t0x%x\n", tp->HwSuppDashVer);
1001 seq_printf(m, "DASH\t0x%x\n", tp->DASH);
1002 seq_printf(m, "dash_printer_enabled\t0x%x\n", tp->dash_printer_enabled);
1003 seq_printf(m, "HwSuppKCPOffloadVer\t0x%x\n", tp->HwSuppKCPOffloadVer);
1004 seq_printf(m, "speed_mode\t0x%x\n", speed_mode);
1005 seq_printf(m, "duplex_mode\t0x%x\n", duplex_mode);
1006 seq_printf(m, "autoneg_mode\t0x%x\n", autoneg_mode);
1007 seq_printf(m, "advertising_mode\t0x%x\n", advertising_mode);
1008 seq_printf(m, "aspm\t0x%x\n", aspm);
1009 seq_printf(m, "s5wol\t0x%x\n", s5wol);
1010 seq_printf(m, "s5_keep_curr_mac\t0x%x\n", s5_keep_curr_mac);
1011 seq_printf(m, "eee_enable\t0x%x\n", tp->eee_enabled);
1012 seq_printf(m, "hwoptimize\t0x%lx\n", hwoptimize);
1013 seq_printf(m, "proc_init_num\t0x%x\n", proc_init_num);
1014 seq_printf(m, "s0_magic_packet\t0x%x\n", s0_magic_packet);
1015 seq_printf(m, "HwSuppMagicPktVer\t0x%x\n", tp->HwSuppMagicPktVer);
1016 seq_printf(m, "HwSuppUpsVer\t0x%x\n", tp->HwSuppUpsVer);
1017 seq_printf(m, "HwSuppEsdVer\t0x%x\n", tp->HwSuppEsdVer);
1018 seq_printf(m, "HwSuppCheckPhyDisableModeVer\t0x%x\n", tp->HwSuppCheckPhyDisableModeVer);
1019 seq_printf(m, "HwPkgDet\t0x%x\n", tp->HwPkgDet);
1020 seq_printf(m, "random_mac\t0x%x\n", tp->random_mac);
1021 seq_printf(m, "org_mac_addr\t%pM\n", tp->org_mac_addr);
1022 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
1023 seq_printf(m, "perm_addr\t%pM\n", dev->perm_addr);
1024 #endif
1025 seq_printf(m, "dev_addr\t%pM\n", dev->dev_addr);
1026 spin_unlock_irqrestore(&tp->lock, flags);
1027
1028 seq_putc(m, '\n');
1029 return 0;
1030 }
1031
proc_get_tally_counter(struct seq_file * m,void * v)1032 static int proc_get_tally_counter(struct seq_file *m, void *v)
1033 {
1034 struct net_device *dev = m->private;
1035 struct rtl8168_private *tp = netdev_priv(dev);
1036 struct rtl8168_counters *counters;
1037 dma_addr_t paddr;
1038 u32 cmd;
1039 u32 WaitCnt;
1040 unsigned long flags;
1041
1042 seq_puts(m, "\nDump Tally Counter\n");
1043
1044 //ASSERT_RTNL();
1045
1046 counters = tp->tally_vaddr;
1047 paddr = tp->tally_paddr;
1048 if (!counters) {
1049 seq_puts(m, "\nDump Tally Counter Fail\n");
1050 return 0;
1051 }
1052
1053 spin_lock_irqsave(&tp->lock, flags);
1054 RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32);
1055 cmd = (u64)paddr & DMA_BIT_MASK(32);
1056 RTL_W32(tp, CounterAddrLow, cmd);
1057 RTL_W32(tp, CounterAddrLow, cmd | CounterDump);
1058
1059 WaitCnt = 0;
1060 while (RTL_R32(tp, CounterAddrLow) & CounterDump) {
1061 udelay(10);
1062
1063 WaitCnt++;
1064 if (WaitCnt > 20)
1065 break;
1066 }
1067 spin_unlock_irqrestore(&tp->lock, flags);
1068
1069 seq_puts(m, "Statistics\tValue\n----------\t-----\n");
1070 seq_printf(m, "tx_packets\t%lld\n", le64_to_cpu(counters->tx_packets));
1071 seq_printf(m, "rx_packets\t%lld\n", le64_to_cpu(counters->rx_packets));
1072 seq_printf(m, "tx_errors\t%lld\n", le64_to_cpu(counters->tx_errors));
1073 seq_printf(m, "rx_errors\t%d\n", le32_to_cpu(counters->rx_errors));
1074 seq_printf(m, "rx_missed\t%d\n", le16_to_cpu(counters->rx_missed));
1075 seq_printf(m, "align_errors\t%d\n", le16_to_cpu(counters->align_errors));
1076 seq_printf(m, "tx_one_collision\t%d\n", le32_to_cpu(counters->tx_one_collision));
1077 seq_printf(m, "tx_multi_collision\t%d\n", le32_to_cpu(counters->tx_multi_collision));
1078 seq_printf(m, "rx_unicast\t%lld\n", le64_to_cpu(counters->rx_unicast));
1079 seq_printf(m, "rx_broadcast\t%lld\n", le64_to_cpu(counters->rx_broadcast));
1080 seq_printf(m, "rx_multicast\t%d\n", le32_to_cpu(counters->rx_multicast));
1081 seq_printf(m, "tx_aborted\t%d\n", le16_to_cpu(counters->tx_aborted));
1082 seq_printf(m, "tx_underrun\t%d\n", le16_to_cpu(counters->tx_underrun));
1083
1084 seq_putc(m, '\n');
1085 return 0;
1086 }
1087
proc_get_registers(struct seq_file * m,void * v)1088 static int proc_get_registers(struct seq_file *m, void *v)
1089 {
1090 struct net_device *dev = m->private;
1091 int i, n, max = R8168_MAC_REGS_SIZE;
1092 u8 byte_rd;
1093 struct rtl8168_private *tp = netdev_priv(dev);
1094 void __iomem *ioaddr = tp->mmio_addr;
1095 unsigned long flags;
1096
1097 seq_puts(m, "\nDump MAC Registers\n");
1098 seq_puts(m, "Offset\tValue\n------\t-----\n");
1099
1100 spin_lock_irqsave(&tp->lock, flags);
1101 for (n = 0; n < max;) {
1102 seq_printf(m, "\n0x%02x:\t", n);
1103
1104 for (i = 0; i < 16 && n < max; i++, n++) {
1105 byte_rd = readb(ioaddr + n);
1106 seq_printf(m, "%02x ", byte_rd);
1107 }
1108 }
1109 spin_unlock_irqrestore(&tp->lock, flags);
1110
1111 seq_putc(m, '\n');
1112 return 0;
1113 }
1114
proc_get_pcie_phy(struct seq_file * m,void * v)1115 static int proc_get_pcie_phy(struct seq_file *m, void *v)
1116 {
1117 struct net_device *dev = m->private;
1118 int i, n, max = R8168_EPHY_REGS_SIZE/2;
1119 u16 word_rd;
1120 struct rtl8168_private *tp = netdev_priv(dev);
1121 unsigned long flags;
1122
1123 seq_puts(m, "\nDump PCIE PHY\n");
1124 seq_puts(m, "\nOffset\tValue\n------\t-----\n ");
1125
1126 spin_lock_irqsave(&tp->lock, flags);
1127 for (n = 0; n < max;) {
1128 seq_printf(m, "\n0x%02x:\t", n);
1129
1130 for (i = 0; i < 8 && n < max; i++, n++) {
1131 word_rd = rtl8168_ephy_read(tp, n);
1132 seq_printf(m, "%04x ", word_rd);
1133 }
1134 }
1135 spin_unlock_irqrestore(&tp->lock, flags);
1136
1137 seq_putc(m, '\n');
1138 return 0;
1139 }
1140
proc_get_eth_phy(struct seq_file * m,void * v)1141 static int proc_get_eth_phy(struct seq_file *m, void *v)
1142 {
1143 struct net_device *dev = m->private;
1144 int i, n, max = R8168_PHY_REGS_SIZE/2;
1145 u16 word_rd;
1146 struct rtl8168_private *tp = netdev_priv(dev);
1147 unsigned long flags;
1148
1149 seq_puts(m, "\nDump Ethernet PHY\n");
1150 seq_puts(m, "\nOffset\tValue\n------\t-----\n ");
1151
1152 spin_lock_irqsave(&tp->lock, flags);
1153 seq_puts(m, "\n####################page 0##################\n ");
1154 rtl8168_mdio_write(tp, 0x1f, 0x0000);
1155 for (n = 0; n < max;) {
1156 seq_printf(m, "\n0x%02x:\t", n);
1157
1158 for (i = 0; i < 8 && n < max; i++, n++) {
1159 word_rd = rtl8168_mdio_read(tp, n);
1160 seq_printf(m, "%04x ", word_rd);
1161 }
1162 }
1163 spin_unlock_irqrestore(&tp->lock, flags);
1164
1165 seq_putc(m, '\n');
1166 return 0;
1167 }
1168
proc_get_extended_registers(struct seq_file * m,void * v)1169 static int proc_get_extended_registers(struct seq_file *m, void *v)
1170 {
1171 struct net_device *dev = m->private;
1172 int i, n, max = R8168_ERI_REGS_SIZE;
1173 u32 dword_rd;
1174 struct rtl8168_private *tp = netdev_priv(dev);
1175 unsigned long flags;
1176
1177 switch (tp->mcfg) {
1178 case CFG_METHOD_1:
1179 case CFG_METHOD_2:
1180 case CFG_METHOD_3:
1181 /* RTL8168B does not support Extend GMAC */
1182 seq_puts(m, "\nNot Support Dump Extended Registers\n");
1183 return 0;
1184 }
1185
1186 seq_puts(m, "\nDump Extended Registers\n");
1187 seq_puts(m, "\nOffset\tValue\n------\t-----\n ");
1188
1189 spin_lock_irqsave(&tp->lock, flags);
1190 for (n = 0; n < max;) {
1191 seq_printf(m, "\n0x%02x:\t", n);
1192
1193 for (i = 0; i < 4 && n < max; i++, n+=4) {
1194 dword_rd = rtl8168_eri_read(tp, n, 4, ERIAR_ExGMAC);
1195 seq_printf(m, "%08x ", dword_rd);
1196 }
1197 }
1198 spin_unlock_irqrestore(&tp->lock, flags);
1199
1200 seq_putc(m, '\n');
1201 return 0;
1202 }
1203
proc_get_pci_registers(struct seq_file * m,void * v)1204 static int proc_get_pci_registers(struct seq_file *m, void *v)
1205 {
1206 struct net_device *dev = m->private;
1207 int i, n, max = R8168_PCI_REGS_SIZE;
1208 u32 dword_rd;
1209 struct rtl8168_private *tp = netdev_priv(dev);
1210 unsigned long flags;
1211
1212 seq_puts(m, "\nDump PCI Registers\n");
1213 seq_puts(m, "\nOffset\tValue\n------\t-----\n ");
1214
1215 spin_lock_irqsave(&tp->lock, flags);
1216 for (n = 0; n < max;) {
1217 seq_printf(m, "\n0x%03x:\t", n);
1218
1219 for (i = 0; i < 4 && n < max; i++, n+=4) {
1220 pci_read_config_dword(tp->pci_dev, n, &dword_rd);
1221 seq_printf(m, "%08x ", dword_rd);
1222 }
1223 }
1224
1225 n = 0x110;
1226 pci_read_config_dword(tp->pci_dev, n, &dword_rd);
1227 seq_printf(m, "\n0x%03x:\t%08x ", n, dword_rd);
1228 n = 0x70c;
1229 pci_read_config_dword(tp->pci_dev, n, &dword_rd);
1230 seq_printf(m, "\n0x%03x:\t%08x ", n, dword_rd);
1231
1232 spin_unlock_irqrestore(&tp->lock, flags);
1233
1234 seq_putc(m, '\n');
1235 return 0;
1236 }
1237 #else
1238
proc_get_driver_variable(char * page,char ** start,off_t offset,int count,int * eof,void * data)1239 static int proc_get_driver_variable(char *page, char **start,
1240 off_t offset, int count,
1241 int *eof, void *data)
1242 {
1243 struct net_device *dev = data;
1244 struct rtl8168_private *tp = netdev_priv(dev);
1245 unsigned long flags;
1246 int len = 0;
1247
1248 len += snprintf(page + len, count - len,
1249 "\nDump Driver Driver\n");
1250
1251 spin_lock_irqsave(&tp->lock, flags);
1252 len += snprintf(page + len, count - len,
1253 "Variable\tValue\n----------\t-----\n");
1254
1255 len += snprintf(page + len, count - len,
1256 "MODULENAME\t%s\n"
1257 "driver version\t%s\n"
1258 "chipset\t%d\n"
1259 "chipset_name\t%s\n"
1260 "mtu\t%d\n"
1261 "NUM_RX_DESC\t0x%x\n"
1262 "cur_rx\t0x%x\n"
1263 "dirty_rx\t0x%x\n"
1264 "NUM_TX_DESC\t0x%x\n"
1265 "cur_tx\t0x%x\n"
1266 "dirty_tx\t0x%x\n"
1267 "rx_buf_sz\t0x%x\n"
1268 "esd_flag\t0x%x\n"
1269 "pci_cfg_is_read\t0x%x\n"
1270 "rtl8168_rx_config\t0x%x\n"
1271 "cp_cmd\t0x%x\n"
1272 "intr_mask\t0x%x\n"
1273 "timer_intr_mask\t0x%x\n"
1274 "wol_enabled\t0x%x\n"
1275 "wol_opts\t0x%x\n"
1276 "efuse_ver\t0x%x\n"
1277 "eeprom_type\t0x%x\n"
1278 "autoneg\t0x%x\n"
1279 "duplex\t0x%x\n"
1280 "speed\t%d\n"
1281 "advertising\t0x%x\n"
1282 "eeprom_len\t0x%x\n"
1283 "cur_page\t0x%x\n"
1284 "bios_setting\t0x%x\n"
1285 "features\t0x%x\n"
1286 "org_pci_offset_99\t0x%x\n"
1287 "org_pci_offset_180\t0x%x\n"
1288 "issue_offset_99_event\t0x%x\n"
1289 "org_pci_offset_80\t0x%x\n"
1290 "org_pci_offset_81\t0x%x\n"
1291 "use_timer_interrrupt\t0x%x\n"
1292 "HwIcVerUnknown\t0x%x\n"
1293 "NotWrRamCodeToMicroP\t0x%x\n"
1294 "NotWrMcuPatchCode\t0x%x\n"
1295 "HwHasWrRamCodeToMicroP\t0x%x\n"
1296 "sw_ram_code_ver\t0x%x\n"
1297 "hw_ram_code_ver\t0x%x\n"
1298 "rtk_enable_diag\t0x%x\n"
1299 "ShortPacketSwChecksum\t0x%x\n"
1300 "UseSwPaddingShortPkt\t0x%x\n"
1301 "RequireAdcBiasPatch\t0x%x\n"
1302 "AdcBiasPatchIoffset\t0x%x\n"
1303 "RequireAdjustUpsTxLinkPulseTiming\t0x%x\n"
1304 "SwrCnt1msIni\t0x%x\n"
1305 "HwSuppNowIsOobVer\t0x%x\n"
1306 "HwFiberModeVer\t0x%x\n"
1307 "HwFiberStat\t0x%x\n"
1308 "HwSwitchMdiToFiber\t0x%x\n"
1309 "HwSuppSerDesPhyVer\t0x%x\n"
1310 "NicCustLedValue\t0x%x\n"
1311 "RequiredSecLanDonglePatch\t0x%x\n"
1312 "HwSuppDashVer\t0x%x\n"
1313 "DASH\t0x%x\n"
1314 "dash_printer_enabled\t0x%x\n"
1315 "HwSuppKCPOffloadVer\t0x%x\n"
1316 "speed_mode\t0x%x\n"
1317 "duplex_mode\t0x%x\n"
1318 "autoneg_mode\t0x%x\n"
1319 "advertising_mode\t0x%x\n"
1320 "aspm\t0x%x\n"
1321 "s5wol\t0x%x\n"
1322 "s5_keep_curr_mac\t0x%x\n"
1323 "eee_enable\t0x%x\n"
1324 "hwoptimize\t0x%lx\n"
1325 "proc_init_num\t0x%x\n"
1326 "s0_magic_packet\t0x%x\n"
1327 "HwSuppMagicPktVer\t0x%x\n"
1328 "HwSuppUpsVer\t0x%x\n"
1329 "HwSuppEsdVer\t0x%x\n"
1330 "HwSuppCheckPhyDisableModeVer\t0x%x\n"
1331 "HwPkgDet\t0x%x\n"
1332 "random_mac\t0x%x\n"
1333 "org_mac_addr\t%pM\n"
1334 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
1335 "perm_addr\t%pM\n"
1336 #endif
1337 "dev_addr\t%pM\n",
1338 MODULENAME,
1339 RTL8168_VERSION,
1340 tp->chipset,
1341 rtl_chip_info[tp->chipset].name,
1342 dev->mtu,
1343 NUM_RX_DESC,
1344 tp->cur_rx,
1345 tp->dirty_rx,
1346 NUM_TX_DESC,
1347 tp->cur_tx,
1348 tp->dirty_tx,
1349 tp->rx_buf_sz,
1350 tp->esd_flag,
1351 tp->pci_cfg_is_read,
1352 tp->rtl8168_rx_config,
1353 tp->cp_cmd,
1354 tp->intr_mask,
1355 tp->timer_intr_mask,
1356 tp->wol_enabled,
1357 tp->wol_opts,
1358 tp->efuse_ver,
1359 tp->eeprom_type,
1360 tp->autoneg,
1361 tp->duplex,
1362 tp->speed,
1363 tp->advertising,
1364 tp->eeprom_len,
1365 tp->cur_page,
1366 tp->bios_setting,
1367 tp->features,
1368 tp->org_pci_offset_99,
1369 tp->org_pci_offset_180,
1370 tp->issue_offset_99_event,
1371 tp->org_pci_offset_80,
1372 tp->org_pci_offset_81,
1373 tp->use_timer_interrrupt,
1374 tp->HwIcVerUnknown,
1375 tp->NotWrRamCodeToMicroP,
1376 tp->NotWrMcuPatchCode,
1377 tp->HwHasWrRamCodeToMicroP,
1378 tp->sw_ram_code_ver,
1379 tp->hw_ram_code_ver,
1380 tp->rtk_enable_diag,
1381 tp->ShortPacketSwChecksum,
1382 tp->UseSwPaddingShortPkt,
1383 tp->RequireAdcBiasPatch,
1384 tp->AdcBiasPatchIoffset,
1385 tp->RequireAdjustUpsTxLinkPulseTiming,
1386 tp->SwrCnt1msIni,
1387 tp->HwSuppNowIsOobVer,
1388 tp->HwFiberModeVer,
1389 tp->HwFiberStat,
1390 tp->HwSwitchMdiToFiber,
1391 tp->HwSuppSerDesPhyVer,
1392 tp->NicCustLedValue,
1393 tp->RequiredSecLanDonglePatch,
1394 tp->HwSuppDashVer,
1395 tp->DASH,
1396 tp->dash_printer_enabled,
1397 tp->HwSuppKCPOffloadVer,
1398 speed_mode,
1399 duplex_mode,
1400 autoneg_mode,
1401 advertising_mode,
1402 aspm,
1403 s5wol,
1404 s5_keep_curr_mac,
1405 tp->eee_enabled,
1406 hwoptimize,
1407 proc_init_num,
1408 s0_magic_packet,
1409 tp->HwSuppMagicPktVer,
1410 tp->HwSuppUpsVer,
1411 tp->HwSuppEsdVer,
1412 tp->HwSuppCheckPhyDisableModeVer,
1413 tp->HwPkgDet,
1414 tp->random_mac,
1415 tp->org_mac_addr,
1416 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
1417 dev->perm_addr,
1418 #endif
1419 dev->dev_addr
1420 );
1421 spin_unlock_irqrestore(&tp->lock, flags);
1422
1423 len += snprintf(page + len, count - len, "\n");
1424
1425 *eof = 1;
1426 return len;
1427 }
1428
proc_get_tally_counter(char * page,char ** start,off_t offset,int count,int * eof,void * data)1429 static int proc_get_tally_counter(char *page, char **start,
1430 off_t offset, int count,
1431 int *eof, void *data)
1432 {
1433 struct net_device *dev = data;
1434 struct rtl8168_private *tp = netdev_priv(dev);
1435 struct rtl8168_counters *counters;
1436 dma_addr_t paddr;
1437 u32 cmd;
1438 u32 WaitCnt;
1439 unsigned long flags;
1440 int len = 0;
1441
1442 len += snprintf(page + len, count - len,
1443 "\nDump Tally Counter\n");
1444
1445 //ASSERT_RTNL();
1446
1447 counters = tp->tally_vaddr;
1448 paddr = tp->tally_paddr;
1449 if (!counters) {
1450 len += snprintf(page + len, count - len,
1451 "\nDump Tally Counter Fail\n");
1452 goto out;
1453 }
1454
1455 spin_lock_irqsave(&tp->lock, flags);
1456 RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32);
1457 cmd = (u64)paddr & DMA_BIT_MASK(32);
1458 RTL_W32(tp, CounterAddrLow, cmd);
1459 RTL_W32(tp, CounterAddrLow, cmd | CounterDump);
1460
1461 WaitCnt = 0;
1462 while (RTL_R32(tp, CounterAddrLow) & CounterDump) {
1463 udelay(10);
1464
1465 WaitCnt++;
1466 if (WaitCnt > 20)
1467 break;
1468 }
1469 spin_unlock_irqrestore(&tp->lock, flags);
1470
1471 len += snprintf(page + len, count - len,
1472 "Statistics\tValue\n----------\t-----\n");
1473
1474 len += snprintf(page + len, count - len,
1475 "tx_packets\t%lld\n"
1476 "rx_packets\t%lld\n"
1477 "tx_errors\t%lld\n"
1478 "rx_errors\t%d\n"
1479 "rx_missed\t%d\n"
1480 "align_errors\t%d\n"
1481 "tx_one_collision\t%d\n"
1482 "tx_multi_collision\t%d\n"
1483 "rx_unicast\t%lld\n"
1484 "rx_broadcast\t%lld\n"
1485 "rx_multicast\t%d\n"
1486 "tx_aborted\t%d\n"
1487 "tx_underrun\t%d\n",
1488 le64_to_cpu(counters->tx_packets),
1489 le64_to_cpu(counters->rx_packets),
1490 le64_to_cpu(counters->tx_errors),
1491 le32_to_cpu(counters->rx_errors),
1492 le16_to_cpu(counters->rx_missed),
1493 le16_to_cpu(counters->align_errors),
1494 le32_to_cpu(counters->tx_one_collision),
1495 le32_to_cpu(counters->tx_multi_collision),
1496 le64_to_cpu(counters->rx_unicast),
1497 le64_to_cpu(counters->rx_broadcast),
1498 le32_to_cpu(counters->rx_multicast),
1499 le16_to_cpu(counters->tx_aborted),
1500 le16_to_cpu(counters->tx_underrun)
1501 );
1502
1503 len += snprintf(page + len, count - len, "\n");
1504 out:
1505 *eof = 1;
1506 return len;
1507 }
1508
proc_get_registers(char * page,char ** start,off_t offset,int count,int * eof,void * data)1509 static int proc_get_registers(char *page, char **start,
1510 off_t offset, int count,
1511 int *eof, void *data)
1512 {
1513 struct net_device *dev = data;
1514 int i, n, max = R8168_MAC_REGS_SIZE;
1515 u8 byte_rd;
1516 struct rtl8168_private *tp = netdev_priv(dev);
1517 void __iomem *ioaddr = tp->mmio_addr;
1518 unsigned long flags;
1519 int len = 0;
1520
1521 len += snprintf(page + len, count - len,
1522 "\nDump MAC Registers\n"
1523 "Offset\tValue\n------\t-----\n");
1524
1525 spin_lock_irqsave(&tp->lock, flags);
1526 for (n = 0; n < max;) {
1527 len += snprintf(page + len, count - len,
1528 "\n0x%02x:\t",
1529 n);
1530
1531 for (i = 0; i < 16 && n < max; i++, n++) {
1532 byte_rd = readb(ioaddr + n);
1533 len += snprintf(page + len, count - len,
1534 "%02x ",
1535 byte_rd);
1536 }
1537 }
1538 spin_unlock_irqrestore(&tp->lock, flags);
1539
1540 len += snprintf(page + len, count - len, "\n");
1541
1542 *eof = 1;
1543 return len;
1544 }
1545
proc_get_pcie_phy(char * page,char ** start,off_t offset,int count,int * eof,void * data)1546 static int proc_get_pcie_phy(char *page, char **start,
1547 off_t offset, int count,
1548 int *eof, void *data)
1549 {
1550 struct net_device *dev = data;
1551 int i, n, max = R8168_EPHY_REGS_SIZE/2;
1552 u16 word_rd;
1553 struct rtl8168_private *tp = netdev_priv(dev);
1554 unsigned long flags;
1555 int len = 0;
1556
1557 len += snprintf(page + len, count - len,
1558 "\nDump PCIE PHY\n"
1559 "Offset\tValue\n------\t-----\n");
1560
1561 spin_lock_irqsave(&tp->lock, flags);
1562 for (n = 0; n < max;) {
1563 len += snprintf(page + len, count - len,
1564 "\n0x%02x:\t",
1565 n);
1566
1567 for (i = 0; i < 8 && n < max; i++, n++) {
1568 word_rd = rtl8168_ephy_read(tp, n);
1569 len += snprintf(page + len, count - len,
1570 "%04x ",
1571 word_rd);
1572 }
1573 }
1574 spin_unlock_irqrestore(&tp->lock, flags);
1575
1576 len += snprintf(page + len, count - len, "\n");
1577
1578 *eof = 1;
1579 return len;
1580 }
1581
proc_get_eth_phy(char * page,char ** start,off_t offset,int count,int * eof,void * data)1582 static int proc_get_eth_phy(char *page, char **start,
1583 off_t offset, int count,
1584 int *eof, void *data)
1585 {
1586 struct net_device *dev = data;
1587 int i, n, max = R8168_PHY_REGS_SIZE/2;
1588 u16 word_rd;
1589 struct rtl8168_private *tp = netdev_priv(dev);
1590 unsigned long flags;
1591 int len = 0;
1592
1593 len += snprintf(page + len, count - len,
1594 "\nDump Ethernet PHY\n"
1595 "Offset\tValue\n------\t-----\n");
1596
1597 spin_lock_irqsave(&tp->lock, flags);
1598 len += snprintf(page + len, count - len,
1599 "\n####################page 0##################\n");
1600 rtl8168_mdio_write(tp, 0x1f, 0x0000);
1601 for (n = 0; n < max;) {
1602 len += snprintf(page + len, count - len,
1603 "\n0x%02x:\t",
1604 n);
1605
1606 for (i = 0; i < 8 && n < max; i++, n++) {
1607 word_rd = rtl8168_mdio_read(tp, n);
1608 len += snprintf(page + len, count - len,
1609 "%04x ",
1610 word_rd);
1611 }
1612 }
1613 spin_unlock_irqrestore(&tp->lock, flags);
1614
1615 len += snprintf(page + len, count - len, "\n");
1616
1617 *eof = 1;
1618 return len;
1619 }
1620
proc_get_extended_registers(char * page,char ** start,off_t offset,int count,int * eof,void * data)1621 static int proc_get_extended_registers(char *page, char **start,
1622 off_t offset, int count,
1623 int *eof, void *data)
1624 {
1625 struct net_device *dev = data;
1626 int i, n, max = R8168_ERI_REGS_SIZE;
1627 u32 dword_rd;
1628 struct rtl8168_private *tp = netdev_priv(dev);
1629 unsigned long flags;
1630 int len = 0;
1631
1632 switch (tp->mcfg) {
1633 case CFG_METHOD_1:
1634 case CFG_METHOD_2:
1635 case CFG_METHOD_3:
1636 /* RTL8168B does not support Extend GMAC */
1637 len += snprintf(page + len, count - len,
1638 "\nNot Support Dump Extended Registers\n");
1639
1640 goto out;
1641 }
1642
1643 len += snprintf(page + len, count - len,
1644 "\nDump Extended Registers\n"
1645 "Offset\tValue\n------\t-----\n");
1646
1647 spin_lock_irqsave(&tp->lock, flags);
1648 for (n = 0; n < max;) {
1649 len += snprintf(page + len, count - len,
1650 "\n0x%02x:\t",
1651 n);
1652
1653 for (i = 0; i < 4 && n < max; i++, n+=4) {
1654 dword_rd = rtl8168_eri_read(tp, n, 4, ERIAR_ExGMAC);
1655 len += snprintf(page + len, count - len,
1656 "%08x ",
1657 dword_rd);
1658 }
1659 }
1660 spin_unlock_irqrestore(&tp->lock, flags);
1661
1662 len += snprintf(page + len, count - len, "\n");
1663 out:
1664 *eof = 1;
1665 return len;
1666 }
1667
proc_get_pci_registers(char * page,char ** start,off_t offset,int count,int * eof,void * data)1668 static int proc_get_pci_registers(char *page, char **start,
1669 off_t offset, int count,
1670 int *eof, void *data)
1671 {
1672 struct net_device *dev = data;
1673 int i, n, max = R8168_PCI_REGS_SIZE;
1674 u32 dword_rd;
1675 struct rtl8168_private *tp = netdev_priv(dev);
1676 unsigned long flags;
1677 int len = 0;
1678
1679 len += snprintf(page + len, count - len,
1680 "\nDump PCI Registers\n"
1681 "Offset\tValue\n------\t-----\n");
1682
1683 spin_lock_irqsave(&tp->lock, flags);
1684 for (n = 0; n < max;) {
1685 len += snprintf(page + len, count - len,
1686 "\n0x%03x:\t",
1687 n);
1688
1689 for (i = 0; i < 4 && n < max; i++, n+=4) {
1690 pci_read_config_dword(tp->pci_dev, n, &dword_rd);
1691 len += snprintf(page + len, count - len,
1692 "%08x ",
1693 dword_rd);
1694 }
1695 }
1696
1697 n = 0x110;
1698 pci_read_config_dword(tp->pci_dev, n, &dword_rd);
1699 len += snprintf(page + len, count - len,
1700 "\n0x%03x:\t%08x ",
1701 n,
1702 dword_rd);
1703 n = 0x70c;
1704 pci_read_config_dword(tp->pci_dev, n, &dword_rd);
1705 len += snprintf(page + len, count - len,
1706 "\n0x%03x:\t%08x ",
1707 n,
1708 dword_rd);
1709 spin_unlock_irqrestore(&tp->lock, flags);
1710
1711 len += snprintf(page + len, count - len, "\n");
1712
1713 *eof = 1;
1714 return len;
1715 }
1716 #endif
rtl8168_proc_module_init(void)1717 static void rtl8168_proc_module_init(void)
1718 {
1719 //create /proc/net/r8168
1720 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
1721 rtl8168_proc = proc_mkdir(MODULENAME, init_net.proc_net);
1722 #else
1723 rtl8168_proc = proc_mkdir(MODULENAME, proc_net);
1724 #endif
1725 if (!rtl8168_proc)
1726 dprintk("cannot create %s proc entry \n", MODULENAME);
1727 }
1728
1729 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1730 /*
1731 * seq_file wrappers for procfile show routines.
1732 */
rtl8168_proc_open(struct inode * inode,struct file * file)1733 static int rtl8168_proc_open(struct inode *inode, struct file *file)
1734 {
1735 struct net_device *dev = proc_get_parent_data(inode);
1736 int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
1737
1738 return single_open(file, show, dev);
1739 }
1740
1741 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
1742 static const struct proc_ops rtl8168_proc_fops = {
1743 .proc_open = rtl8168_proc_open,
1744 .proc_read = seq_read,
1745 .proc_lseek = seq_lseek,
1746 .proc_release = single_release,
1747 };
1748 #else
1749 static const struct file_operations rtl8168_proc_fops = {
1750 .open = rtl8168_proc_open,
1751 .read = seq_read,
1752 .llseek = seq_lseek,
1753 .release = single_release,
1754 };
1755 #endif
1756
1757 #endif
1758
1759 /*
1760 * Table of proc files we need to create.
1761 */
1762 struct rtl8168_proc_file {
1763 char name[12];
1764 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1765 int (*show)(struct seq_file *, void *);
1766 #else
1767 int (*show)(char *, char **, off_t, int, int *, void *);
1768 #endif
1769 };
1770
1771 static const struct rtl8168_proc_file rtl8168_proc_files[] = {
1772 { "driver_var", &proc_get_driver_variable },
1773 { "tally", &proc_get_tally_counter },
1774 { "registers", &proc_get_registers },
1775 { "pcie_phy", &proc_get_pcie_phy },
1776 { "eth_phy", &proc_get_eth_phy },
1777 { "ext_regs", &proc_get_extended_registers },
1778 { "pci_regs", &proc_get_pci_registers },
1779 { "" }
1780 };
1781
rtl8168_proc_init(struct net_device * dev)1782 static void rtl8168_proc_init(struct net_device *dev)
1783 {
1784 struct rtl8168_private *tp = netdev_priv(dev);
1785 const struct rtl8168_proc_file *f;
1786 struct proc_dir_entry *dir;
1787
1788 if (rtl8168_proc && !tp->proc_dir) {
1789 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1790 dir = proc_mkdir_data(dev->name, 0, rtl8168_proc, dev);
1791 if (!dir) {
1792 printk("Unable to initialize /proc/net/%s/%s\n",
1793 MODULENAME, dev->name);
1794 return;
1795 }
1796
1797 tp->proc_dir = dir;
1798 proc_init_num++;
1799
1800 for (f = rtl8168_proc_files; f->name[0]; f++) {
1801 if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
1802 &rtl8168_proc_fops, f->show)) {
1803 printk("Unable to initialize "
1804 "/proc/net/%s/%s/%s\n",
1805 MODULENAME, dev->name, f->name);
1806 return;
1807 }
1808 }
1809 #else
1810 dir = proc_mkdir(dev->name, rtl8168_proc);
1811 if (!dir) {
1812 printk("Unable to initialize /proc/net/%s/%s\n",
1813 MODULENAME, dev->name);
1814 return;
1815 }
1816
1817 tp->proc_dir = dir;
1818 proc_init_num++;
1819
1820 for (f = rtl8168_proc_files; f->name[0]; f++) {
1821 if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO,
1822 dir, f->show, dev)) {
1823 printk("Unable to initialize "
1824 "/proc/net/%s/%s/%s\n",
1825 MODULENAME, dev->name, f->name);
1826 return;
1827 }
1828 }
1829 #endif
1830 }
1831 }
1832
rtl8168_proc_remove(struct net_device * dev)1833 static void rtl8168_proc_remove(struct net_device *dev)
1834 {
1835 struct rtl8168_private *tp = netdev_priv(dev);
1836
1837 if (tp->proc_dir) {
1838 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1839 remove_proc_subtree(dev->name, rtl8168_proc);
1840 proc_init_num--;
1841
1842 #else
1843 const struct rtl8168_proc_file *f;
1844 struct rtl8168_private *tp = netdev_priv(dev);
1845
1846 for (f = rtl8168_proc_files; f->name[0]; f++)
1847 remove_proc_entry(f->name, tp->proc_dir);
1848
1849 remove_proc_entry(dev->name, rtl8168_proc);
1850 proc_init_num--;
1851 #endif
1852 tp->proc_dir = NULL;
1853 }
1854 }
1855
1856 #endif //ENABLE_R8168_PROCFS
1857
map_phy_ocp_addr(u16 PageNum,u8 RegNum)1858 static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum)
1859 {
1860 u16 OcpPageNum = 0;
1861 u8 OcpRegNum = 0;
1862 u16 OcpPhyAddress = 0;
1863
1864 if ( PageNum == 0 ) {
1865 OcpPageNum = OCP_STD_PHY_BASE_PAGE + ( RegNum / 8 );
1866 OcpRegNum = 0x10 + ( RegNum % 8 );
1867 } else {
1868 OcpPageNum = PageNum;
1869 OcpRegNum = RegNum;
1870 }
1871
1872 OcpPageNum <<= 4;
1873
1874 if ( OcpRegNum < 16 ) {
1875 OcpPhyAddress = 0;
1876 } else {
1877 OcpRegNum -= 16;
1878 OcpRegNum <<= 1;
1879
1880 OcpPhyAddress = OcpPageNum + OcpRegNum;
1881 }
1882
1883
1884 return OcpPhyAddress;
1885 }
1886
mdio_real_direct_write_phy_ocp(struct rtl8168_private * tp,u32 RegAddr,u32 value)1887 static void mdio_real_direct_write_phy_ocp(struct rtl8168_private *tp,
1888 u32 RegAddr,
1889 u32 value)
1890 {
1891 u32 data32;
1892 int i;
1893
1894 if (tp->HwSuppPhyOcpVer == 0) goto out;
1895
1896 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
1897 WARN_ON_ONCE(RegAddr % 2);
1898 #endif
1899 data32 = RegAddr/2;
1900 data32 <<= OCPR_Addr_Reg_shift;
1901 data32 |= OCPR_Write | value;
1902
1903 RTL_W32(tp, PHYOCP, data32);
1904 for (i = 0; i < 100; i++) {
1905 udelay(1);
1906
1907 if (!(RTL_R32(tp, PHYOCP) & OCPR_Flag))
1908 break;
1909 }
1910 out:
1911 return;
1912 }
1913
mdio_direct_write_phy_ocp(struct rtl8168_private * tp,u16 RegAddr,u16 value)1914 static void mdio_direct_write_phy_ocp(struct rtl8168_private *tp,
1915 u16 RegAddr,
1916 u16 value)
1917 {
1918 if (tp->rtk_enable_diag) return;
1919
1920 mdio_real_direct_write_phy_ocp(tp, RegAddr, value);
1921 }
1922
rtl8168_mdio_write_phy_ocp(struct rtl8168_private * tp,u16 PageNum,u32 RegAddr,u32 value)1923 static void rtl8168_mdio_write_phy_ocp(struct rtl8168_private *tp,
1924 u16 PageNum,
1925 u32 RegAddr,
1926 u32 value)
1927 {
1928 u16 ocp_addr;
1929
1930 if (tp->rtk_enable_diag) return;
1931
1932 ocp_addr = map_phy_ocp_addr(PageNum, RegAddr);
1933
1934 mdio_direct_write_phy_ocp(tp, ocp_addr, value);
1935 }
1936
rtl8168_mdio_real_write_phy_ocp(struct rtl8168_private * tp,u16 PageNum,u32 RegAddr,u32 value)1937 static void rtl8168_mdio_real_write_phy_ocp(struct rtl8168_private *tp,
1938 u16 PageNum,
1939 u32 RegAddr,
1940 u32 value)
1941 {
1942 u16 ocp_addr;
1943
1944 ocp_addr = map_phy_ocp_addr(PageNum, RegAddr);
1945
1946 mdio_real_direct_write_phy_ocp(tp, ocp_addr, value);
1947 }
1948
mdio_real_write(struct rtl8168_private * tp,u32 RegAddr,u32 value)1949 static void mdio_real_write(struct rtl8168_private *tp,
1950 u32 RegAddr,
1951 u32 value)
1952 {
1953 int i;
1954
1955 if (RegAddr == 0x1F) {
1956 tp->cur_page = value;
1957 }
1958
1959 if (tp->mcfg == CFG_METHOD_11) {
1960 RTL_W32(tp, OCPDR, OCPDR_Write |
1961 (RegAddr & OCPDR_Reg_Mask) << OCPDR_GPHY_Reg_shift |
1962 (value & OCPDR_Data_Mask));
1963 RTL_W32(tp, OCPAR, OCPAR_GPHY_Write);
1964 RTL_W32(tp, EPHY_RXER_NUM, 0);
1965
1966 for (i = 0; i < 100; i++) {
1967 mdelay(1);
1968 if (!(RTL_R32(tp, OCPAR) & OCPAR_Flag))
1969 break;
1970 }
1971 } else {
1972 if (tp->HwSuppPhyOcpVer > 0) {
1973 if (RegAddr == 0x1F) {
1974 return;
1975 }
1976 rtl8168_mdio_real_write_phy_ocp(tp, tp->cur_page, RegAddr, value);
1977 } else {
1978 if (tp->mcfg == CFG_METHOD_12 || tp->mcfg == CFG_METHOD_13)
1979 RTL_W32(tp, 0xD0, RTL_R32(tp, 0xD0) & ~0x00020000);
1980
1981 RTL_W32(tp, PHYAR, PHYAR_Write |
1982 (RegAddr & PHYAR_Reg_Mask) << PHYAR_Reg_shift |
1983 (value & PHYAR_Data_Mask));
1984
1985 for (i = 0; i < 10; i++) {
1986 udelay(100);
1987
1988 /* Check if the RTL8168 has completed writing to the specified MII register */
1989 if (!(RTL_R32(tp, PHYAR) & PHYAR_Flag)) {
1990 udelay(20);
1991 break;
1992 }
1993 }
1994
1995 if (tp->mcfg == CFG_METHOD_12 || tp->mcfg == CFG_METHOD_13)
1996 RTL_W32(tp, 0xD0, RTL_R32(tp, 0xD0) | 0x00020000);
1997 }
1998 }
1999 }
2000
rtl8168_mdio_write(struct rtl8168_private * tp,u16 RegAddr,u16 value)2001 void rtl8168_mdio_write(struct rtl8168_private *tp,
2002 u16 RegAddr,
2003 u16 value)
2004 {
2005 if (tp->rtk_enable_diag) return;
2006
2007 mdio_real_write(tp, RegAddr, value);
2008 }
2009
rtl8168_mdio_prot_write(struct rtl8168_private * tp,u32 RegAddr,u32 value)2010 void rtl8168_mdio_prot_write(struct rtl8168_private *tp,
2011 u32 RegAddr,
2012 u32 value)
2013 {
2014 mdio_real_write(tp, RegAddr, value);
2015 }
2016
rtl8168_mdio_prot_direct_write_phy_ocp(struct rtl8168_private * tp,u32 RegAddr,u32 value)2017 void rtl8168_mdio_prot_direct_write_phy_ocp(struct rtl8168_private *tp,
2018 u32 RegAddr,
2019 u32 value)
2020 {
2021 mdio_real_direct_write_phy_ocp(tp, RegAddr, value);
2022 }
2023
mdio_real_direct_read_phy_ocp(struct rtl8168_private * tp,u32 RegAddr)2024 static u32 mdio_real_direct_read_phy_ocp(struct rtl8168_private *tp,
2025 u32 RegAddr)
2026 {
2027 u32 data32;
2028 int i, value = 0;
2029
2030 if (tp->HwSuppPhyOcpVer == 0) goto out;
2031
2032 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
2033 WARN_ON_ONCE(RegAddr % 2);
2034 #endif
2035 data32 = RegAddr/2;
2036 data32 <<= OCPR_Addr_Reg_shift;
2037
2038 RTL_W32(tp, PHYOCP, data32);
2039 for (i = 0; i < 100; i++) {
2040 udelay(1);
2041
2042 if (RTL_R32(tp, PHYOCP) & OCPR_Flag)
2043 break;
2044 }
2045 value = RTL_R32(tp, PHYOCP) & OCPDR_Data_Mask;
2046
2047 out:
2048 return value;
2049 }
2050
mdio_direct_read_phy_ocp(struct rtl8168_private * tp,u16 RegAddr)2051 static u32 mdio_direct_read_phy_ocp(struct rtl8168_private *tp,
2052 u16 RegAddr)
2053 {
2054 if (tp->rtk_enable_diag) return 0xffffffff;
2055
2056 return mdio_real_direct_read_phy_ocp(tp, RegAddr);
2057 }
2058
rtl8168_mdio_read_phy_ocp(struct rtl8168_private * tp,u16 PageNum,u32 RegAddr)2059 static u32 rtl8168_mdio_read_phy_ocp(struct rtl8168_private *tp,
2060 u16 PageNum,
2061 u32 RegAddr)
2062 {
2063 u16 ocp_addr;
2064
2065 if (tp->rtk_enable_diag) return 0xffffffff;
2066
2067 ocp_addr = map_phy_ocp_addr(PageNum, RegAddr);
2068
2069 return mdio_direct_read_phy_ocp(tp, ocp_addr);
2070 }
2071
rtl8168_mdio_real_read_phy_ocp(struct rtl8168_private * tp,u16 PageNum,u32 RegAddr)2072 static u32 rtl8168_mdio_real_read_phy_ocp(struct rtl8168_private *tp,
2073 u16 PageNum,
2074 u32 RegAddr)
2075 {
2076 u16 ocp_addr;
2077
2078 ocp_addr = map_phy_ocp_addr(PageNum, RegAddr);
2079
2080 return mdio_real_direct_read_phy_ocp(tp, ocp_addr);
2081 }
2082
mdio_real_read(struct rtl8168_private * tp,u32 RegAddr)2083 u32 mdio_real_read(struct rtl8168_private *tp,
2084 u32 RegAddr)
2085 {
2086 int i, value = 0;
2087
2088 if (tp->mcfg==CFG_METHOD_11) {
2089 RTL_W32(tp, OCPDR, OCPDR_Read |
2090 (RegAddr & OCPDR_Reg_Mask) << OCPDR_GPHY_Reg_shift);
2091 RTL_W32(tp, OCPAR, OCPAR_GPHY_Write);
2092 RTL_W32(tp, EPHY_RXER_NUM, 0);
2093
2094 for (i = 0; i < 100; i++) {
2095 mdelay(1);
2096 if (!(RTL_R32(tp, OCPAR) & OCPAR_Flag))
2097 break;
2098 }
2099
2100 mdelay(1);
2101 RTL_W32(tp, OCPAR, OCPAR_GPHY_Read);
2102 RTL_W32(tp, EPHY_RXER_NUM, 0);
2103
2104 for (i = 0; i < 100; i++) {
2105 mdelay(1);
2106 if (RTL_R32(tp, OCPAR) & OCPAR_Flag)
2107 break;
2108 }
2109
2110 value = RTL_R32(tp, OCPDR) & OCPDR_Data_Mask;
2111 } else {
2112 if (tp->HwSuppPhyOcpVer > 0) {
2113 value = rtl8168_mdio_real_read_phy_ocp(tp, tp->cur_page, RegAddr);
2114 } else {
2115 if (tp->mcfg == CFG_METHOD_12 || tp->mcfg == CFG_METHOD_13)
2116 RTL_W32(tp, 0xD0, RTL_R32(tp, 0xD0) & ~0x00020000);
2117
2118 RTL_W32(tp, PHYAR,
2119 PHYAR_Read | (RegAddr & PHYAR_Reg_Mask) << PHYAR_Reg_shift);
2120
2121 for (i = 0; i < 10; i++) {
2122 udelay(100);
2123
2124 /* Check if the RTL8168 has completed retrieving data from the specified MII register */
2125 if (RTL_R32(tp, PHYAR) & PHYAR_Flag) {
2126 value = RTL_R32(tp, PHYAR) & PHYAR_Data_Mask;
2127 udelay(20);
2128 break;
2129 }
2130 }
2131
2132 if (tp->mcfg == CFG_METHOD_12 || tp->mcfg == CFG_METHOD_13)
2133 RTL_W32(tp, 0xD0, RTL_R32(tp, 0xD0) | 0x00020000);
2134 }
2135 }
2136
2137 return value;
2138 }
2139
rtl8168_mdio_read(struct rtl8168_private * tp,u16 RegAddr)2140 u32 rtl8168_mdio_read(struct rtl8168_private *tp,
2141 u16 RegAddr)
2142 {
2143 if (tp->rtk_enable_diag) return 0xffffffff;
2144
2145 return mdio_real_read(tp, RegAddr);
2146 }
2147
rtl8168_mdio_prot_read(struct rtl8168_private * tp,u32 RegAddr)2148 u32 rtl8168_mdio_prot_read(struct rtl8168_private *tp,
2149 u32 RegAddr)
2150 {
2151 return mdio_real_read(tp, RegAddr);
2152 }
2153
rtl8168_mdio_prot_direct_read_phy_ocp(struct rtl8168_private * tp,u32 RegAddr)2154 u32 rtl8168_mdio_prot_direct_read_phy_ocp(struct rtl8168_private *tp,
2155 u32 RegAddr)
2156 {
2157 return mdio_real_direct_read_phy_ocp(tp, RegAddr);
2158 }
2159
ClearAndSetEthPhyBit(struct rtl8168_private * tp,u8 addr,u16 clearmask,u16 setmask)2160 static void ClearAndSetEthPhyBit(struct rtl8168_private *tp, u8 addr, u16 clearmask, u16 setmask)
2161 {
2162 u16 PhyRegValue;
2163
2164
2165 PhyRegValue = rtl8168_mdio_read(tp, addr);
2166 PhyRegValue &= ~clearmask;
2167 PhyRegValue |= setmask;
2168 rtl8168_mdio_write(tp, addr, PhyRegValue);
2169 }
2170
rtl8168_clear_eth_phy_bit(struct rtl8168_private * tp,u8 addr,u16 mask)2171 void rtl8168_clear_eth_phy_bit(struct rtl8168_private *tp, u8 addr, u16 mask)
2172 {
2173 ClearAndSetEthPhyBit(tp,
2174 addr,
2175 mask,
2176 0
2177 );
2178 }
2179
rtl8168_set_eth_phy_bit(struct rtl8168_private * tp,u8 addr,u16 mask)2180 void rtl8168_set_eth_phy_bit(struct rtl8168_private *tp, u8 addr, u16 mask)
2181 {
2182 ClearAndSetEthPhyBit(tp,
2183 addr,
2184 0,
2185 mask
2186 );
2187 }
2188
rtl8168_mac_ocp_write(struct rtl8168_private * tp,u16 reg_addr,u16 value)2189 void rtl8168_mac_ocp_write(struct rtl8168_private *tp, u16 reg_addr, u16 value)
2190 {
2191 u32 data32;
2192
2193 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
2194 WARN_ON_ONCE(reg_addr % 2);
2195 #endif
2196
2197 data32 = reg_addr/2;
2198 data32 <<= OCPR_Addr_Reg_shift;
2199 data32 += value;
2200 data32 |= OCPR_Write;
2201
2202 RTL_W32(tp, MACOCP, data32);
2203 }
2204
rtl8168_mac_ocp_read(struct rtl8168_private * tp,u16 reg_addr)2205 u16 rtl8168_mac_ocp_read(struct rtl8168_private *tp, u16 reg_addr)
2206 {
2207 u32 data32;
2208 u16 data16 = 0;
2209
2210 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
2211 WARN_ON_ONCE(reg_addr % 2);
2212 #endif
2213
2214 data32 = reg_addr/2;
2215 data32 <<= OCPR_Addr_Reg_shift;
2216
2217 RTL_W32(tp, MACOCP, data32);
2218 data16 = (u16)RTL_R32(tp, MACOCP);
2219
2220 return data16;
2221 }
2222
2223 #ifdef ENABLE_USE_FIRMWARE_FILE
mac_mcu_write(struct rtl8168_private * tp,u16 reg,u16 value)2224 static void mac_mcu_write(struct rtl8168_private *tp, u16 reg, u16 value)
2225 {
2226 if (reg == 0x1f) {
2227 tp->ocp_base = value << 4;
2228 return;
2229 }
2230
2231 rtl8168_mac_ocp_write(tp, tp->ocp_base + reg, value);
2232 }
2233
mac_mcu_read(struct rtl8168_private * tp,u16 reg)2234 static u32 mac_mcu_read(struct rtl8168_private *tp, u16 reg)
2235 {
2236 return rtl8168_mac_ocp_read(tp, tp->ocp_base + reg);
2237 }
2238 #endif
2239
2240 static void
rtl8168_clear_and_set_mcu_ocp_bit(struct rtl8168_private * tp,u16 addr,u16 clearmask,u16 setmask)2241 rtl8168_clear_and_set_mcu_ocp_bit(
2242 struct rtl8168_private *tp,
2243 u16 addr,
2244 u16 clearmask,
2245 u16 setmask
2246 )
2247 {
2248 u16 RegValue;
2249
2250 RegValue = rtl8168_mac_ocp_read(tp, addr);
2251 RegValue &= ~clearmask;
2252 RegValue |= setmask;
2253 rtl8168_mac_ocp_write(tp, addr, RegValue);
2254 }
2255
2256 /*
2257 static void
2258 rtl8168_clear_mcu_ocp_bit(
2259 struct rtl8168_private *tp,
2260 u16 addr,
2261 u16 mask
2262 )
2263 {
2264 rtl8168_clear_and_set_mcu_ocp_bit(tp,
2265 addr,
2266 mask,
2267 0
2268 );
2269 }
2270 */
2271
2272 static void
rtl8168_set_mcu_ocp_bit(struct rtl8168_private * tp,u16 addr,u16 mask)2273 rtl8168_set_mcu_ocp_bit(
2274 struct rtl8168_private *tp,
2275 u16 addr,
2276 u16 mask
2277 )
2278 {
2279 rtl8168_clear_and_set_mcu_ocp_bit(tp,
2280 addr,
2281 0,
2282 mask
2283 );
2284 }
2285
real_ocp_read(struct rtl8168_private * tp,u16 addr,u8 len)2286 static u32 real_ocp_read(struct rtl8168_private *tp, u16 addr, u8 len)
2287 {
2288 int i, val_shift, shift = 0;
2289 u32 value1 = 0, value2 = 0, mask;
2290
2291 if (len > 4 || len <= 0)
2292 return -1;
2293
2294 while (len > 0) {
2295 val_shift = addr % 4;
2296 addr = addr & ~0x3;
2297
2298 RTL_W32(tp, OCPAR, (0x0F<<12) | (addr&0xFFF));
2299
2300 for (i = 0; i < 20; i++) {
2301 udelay(100);
2302 if (RTL_R32(tp, OCPAR) & OCPAR_Flag)
2303 break;
2304 }
2305
2306 if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF;
2307 else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF;
2308 else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
2309 else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
2310
2311 value1 = RTL_R32(tp, OCPDR) & mask;
2312 value2 |= (value1 >> val_shift * 8) << shift * 8;
2313
2314 if (len <= 4 - val_shift) {
2315 len = 0;
2316 } else {
2317 len -= (4 - val_shift);
2318 shift = 4 - val_shift;
2319 addr += 4;
2320 }
2321 }
2322
2323 udelay(20);
2324
2325 return value2;
2326 }
2327
rtl8168_ocp_read_with_oob_base_address(struct rtl8168_private * tp,u16 addr,u8 len,const u32 base_address)2328 u32 rtl8168_ocp_read_with_oob_base_address(struct rtl8168_private *tp, u16 addr, u8 len, const u32 base_address)
2329 {
2330 return rtl8168_eri_read_with_oob_base_address(tp, addr, len, ERIAR_OOB, base_address);
2331 }
2332
rtl8168_ocp_read(struct rtl8168_private * tp,u16 addr,u8 len)2333 u32 rtl8168_ocp_read(struct rtl8168_private *tp, u16 addr, u8 len)
2334 {
2335 u32 value = 0;
2336
2337 if (HW_DASH_SUPPORT_TYPE_2(tp))
2338 value = rtl8168_ocp_read_with_oob_base_address(tp, addr, len, NO_BASE_ADDRESS);
2339 else if (HW_DASH_SUPPORT_TYPE_3(tp))
2340 value = rtl8168_ocp_read_with_oob_base_address(tp, addr, len, RTL8168FP_OOBMAC_BASE);
2341 else
2342 value = real_ocp_read(tp, addr, len);
2343
2344 return value;
2345 }
2346
real_ocp_write(struct rtl8168_private * tp,u16 addr,u8 len,u32 value)2347 static int real_ocp_write(struct rtl8168_private *tp, u16 addr, u8 len, u32 value)
2348 {
2349 int i, val_shift, shift = 0;
2350 u32 value1 = 0, mask;
2351
2352 if (len > 4 || len <= 0)
2353 return -1;
2354
2355 while (len > 0) {
2356 val_shift = addr % 4;
2357 addr = addr & ~0x3;
2358
2359 if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF;
2360 else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF;
2361 else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
2362 else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
2363
2364 value1 = rtl8168_ocp_read(tp, addr, 4) & ~mask;
2365 value1 |= ((value << val_shift * 8) >> shift * 8);
2366
2367 RTL_W32(tp, OCPDR, value1);
2368 RTL_W32(tp, OCPAR, OCPAR_Flag | (0x0F<<12) | (addr&0xFFF));
2369
2370 for (i = 0; i < 10; i++) {
2371 udelay(100);
2372
2373 /* Check if the RTL8168 has completed ERI write */
2374 if (!(RTL_R32(tp, OCPAR) & OCPAR_Flag))
2375 break;
2376 }
2377
2378 if (len <= 4 - val_shift) {
2379 len = 0;
2380 } else {
2381 len -= (4 - val_shift);
2382 shift = 4 - val_shift;
2383 addr += 4;
2384 }
2385 }
2386
2387 udelay(20);
2388
2389 return 0;
2390 }
2391
rtl8168_ocp_write_with_oob_base_address(struct rtl8168_private * tp,u16 addr,u8 len,u32 value,const u32 base_address)2392 u32 rtl8168_ocp_write_with_oob_base_address(struct rtl8168_private *tp, u16 addr, u8 len, u32 value, const u32 base_address)
2393 {
2394 return rtl8168_eri_write_with_oob_base_address(tp, addr, len, value, ERIAR_OOB, base_address);
2395 }
2396
rtl8168_ocp_write(struct rtl8168_private * tp,u16 addr,u8 len,u32 value)2397 void rtl8168_ocp_write(struct rtl8168_private *tp, u16 addr, u8 len, u32 value)
2398 {
2399 if (HW_DASH_SUPPORT_TYPE_2(tp))
2400 rtl8168_ocp_write_with_oob_base_address(tp, addr, len, value, NO_BASE_ADDRESS);
2401 else if (HW_DASH_SUPPORT_TYPE_3(tp))
2402 rtl8168_ocp_write_with_oob_base_address(tp, addr, len, value, RTL8168FP_OOBMAC_BASE);
2403 else
2404 real_ocp_write(tp, addr, len, value);
2405 }
2406
rtl8168_oob_mutex_lock(struct rtl8168_private * tp)2407 void rtl8168_oob_mutex_lock(struct rtl8168_private *tp)
2408 {
2409 u8 reg_16, reg_a0;
2410 u32 wait_cnt_0, wait_Cnt_1;
2411 u16 ocp_reg_mutex_ib;
2412 u16 ocp_reg_mutex_oob;
2413 u16 ocp_reg_mutex_prio;
2414
2415 if (!tp->DASH) return;
2416
2417 switch (tp->mcfg) {
2418 case CFG_METHOD_11:
2419 case CFG_METHOD_12:
2420 ocp_reg_mutex_oob = 0x16;
2421 ocp_reg_mutex_ib = 0x17;
2422 ocp_reg_mutex_prio = 0x9C;
2423 break;
2424 case CFG_METHOD_13:
2425 ocp_reg_mutex_oob = 0x06;
2426 ocp_reg_mutex_ib = 0x07;
2427 ocp_reg_mutex_prio = 0x9C;
2428 break;
2429 case CFG_METHOD_23:
2430 case CFG_METHOD_27:
2431 case CFG_METHOD_28:
2432 case CFG_METHOD_31:
2433 case CFG_METHOD_32:
2434 case CFG_METHOD_33:
2435 default:
2436 ocp_reg_mutex_oob = 0x110;
2437 ocp_reg_mutex_ib = 0x114;
2438 ocp_reg_mutex_prio = 0x11C;
2439 break;
2440 }
2441
2442 rtl8168_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0);
2443 reg_16 = rtl8168_ocp_read(tp, ocp_reg_mutex_oob, 1);
2444 wait_cnt_0 = 0;
2445 while(reg_16) {
2446 reg_a0 = rtl8168_ocp_read(tp, ocp_reg_mutex_prio, 1);
2447 if (reg_a0) {
2448 rtl8168_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00);
2449 reg_a0 = rtl8168_ocp_read(tp, ocp_reg_mutex_prio, 1);
2450 wait_Cnt_1 = 0;
2451 while(reg_a0) {
2452 reg_a0 = rtl8168_ocp_read(tp, ocp_reg_mutex_prio, 1);
2453
2454 wait_Cnt_1++;
2455
2456 if (wait_Cnt_1 > 2000)
2457 break;
2458 };
2459 rtl8168_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0);
2460
2461 }
2462 reg_16 = rtl8168_ocp_read(tp, ocp_reg_mutex_oob, 1);
2463
2464 wait_cnt_0++;
2465
2466 if (wait_cnt_0 > 2000)
2467 break;
2468 };
2469 }
2470
rtl8168_oob_mutex_unlock(struct rtl8168_private * tp)2471 void rtl8168_oob_mutex_unlock(struct rtl8168_private *tp)
2472 {
2473 u16 ocp_reg_mutex_ib;
2474 u16 ocp_reg_mutex_oob;
2475 u16 ocp_reg_mutex_prio;
2476
2477 if (!tp->DASH) return;
2478
2479 switch (tp->mcfg) {
2480 case CFG_METHOD_11:
2481 case CFG_METHOD_12:
2482 ocp_reg_mutex_oob = 0x16;
2483 ocp_reg_mutex_ib = 0x17;
2484 ocp_reg_mutex_prio = 0x9C;
2485 break;
2486 case CFG_METHOD_13:
2487 ocp_reg_mutex_oob = 0x06;
2488 ocp_reg_mutex_ib = 0x07;
2489 ocp_reg_mutex_prio = 0x9C;
2490 break;
2491 case CFG_METHOD_23:
2492 case CFG_METHOD_27:
2493 case CFG_METHOD_28:
2494 case CFG_METHOD_31:
2495 case CFG_METHOD_32:
2496 case CFG_METHOD_33:
2497 default:
2498 ocp_reg_mutex_oob = 0x110;
2499 ocp_reg_mutex_ib = 0x114;
2500 ocp_reg_mutex_prio = 0x11C;
2501 break;
2502 }
2503
2504 rtl8168_ocp_write(tp, ocp_reg_mutex_prio, 1, BIT_0);
2505 rtl8168_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00);
2506 }
2507
rtl8168_oob_notify(struct rtl8168_private * tp,u8 cmd)2508 void rtl8168_oob_notify(struct rtl8168_private *tp, u8 cmd)
2509 {
2510 rtl8168_eri_write(tp, 0xE8, 1, cmd, ERIAR_ExGMAC);
2511
2512 rtl8168_ocp_write(tp, 0x30, 1, 0x01);
2513 }
2514
rtl8168_check_dash(struct rtl8168_private * tp)2515 static int rtl8168_check_dash(struct rtl8168_private *tp)
2516 {
2517 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
2518 if (rtl8168_ocp_read(tp, 0x128, 1) & BIT_0)
2519 return 1;
2520 else
2521 return 0;
2522 } else {
2523 u32 reg;
2524
2525 if (tp->mcfg == CFG_METHOD_13)
2526 reg = 0xb8;
2527 else
2528 reg = 0x10;
2529
2530 if (rtl8168_ocp_read(tp, reg, 2) & 0x00008000)
2531 return 1;
2532 else
2533 return 0;
2534 }
2535 }
2536
rtl8168_dash2_disable_tx(struct rtl8168_private * tp)2537 void rtl8168_dash2_disable_tx(struct rtl8168_private *tp)
2538 {
2539 if (!tp->DASH) return;
2540
2541 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
2542 u16 WaitCnt;
2543 u8 TmpUchar;
2544
2545 //Disable oob Tx
2546 RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) & ~( BIT_0 ));
2547 WaitCnt = 0;
2548
2549 //wait oob tx disable
2550 do {
2551 TmpUchar = RTL_CMAC_R8(tp, CMAC_IBISR0);
2552
2553 if ( TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE ) {
2554 break;
2555 }
2556
2557 udelay( 50 );
2558 WaitCnt++;
2559 } while(WaitCnt < 2000);
2560
2561 //Clear ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE
2562 RTL_CMAC_W8(tp, CMAC_IBISR0, RTL_CMAC_R8(tp, CMAC_IBISR0) | ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE);
2563 }
2564 }
2565
rtl8168_dash2_enable_tx(struct rtl8168_private * tp)2566 void rtl8168_dash2_enable_tx(struct rtl8168_private *tp)
2567 {
2568 if (!tp->DASH) return;
2569
2570 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
2571 RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0);
2572 }
2573 }
2574
rtl8168_dash2_disable_rx(struct rtl8168_private * tp)2575 void rtl8168_dash2_disable_rx(struct rtl8168_private *tp)
2576 {
2577 if (!tp->DASH) return;
2578
2579 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
2580 RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~( BIT_0 ));
2581 }
2582 }
2583
rtl8168_dash2_enable_rx(struct rtl8168_private * tp)2584 void rtl8168_dash2_enable_rx(struct rtl8168_private *tp)
2585 {
2586 if (!tp->DASH) return;
2587
2588 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
2589 RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0);
2590 }
2591 }
2592
rtl8168_dash2_disable_txrx(struct net_device * dev)2593 static void rtl8168_dash2_disable_txrx(struct net_device *dev)
2594 {
2595 struct rtl8168_private *tp = netdev_priv(dev);
2596
2597 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
2598 rtl8168_dash2_disable_tx( tp );
2599 rtl8168_dash2_disable_rx( tp );
2600 }
2601 }
2602
rtl8168_ephy_write(struct rtl8168_private * tp,int RegAddr,int value)2603 void rtl8168_ephy_write(struct rtl8168_private *tp, int RegAddr, int value)
2604 {
2605 int i;
2606
2607 RTL_W32(tp, EPHYAR,
2608 EPHYAR_Write |
2609 (RegAddr & EPHYAR_Reg_Mask) << EPHYAR_Reg_shift |
2610 (value & EPHYAR_Data_Mask));
2611
2612 for (i = 0; i < 10; i++) {
2613 udelay(100);
2614
2615 /* Check if the RTL8168 has completed EPHY write */
2616 if (!(RTL_R32(tp, EPHYAR) & EPHYAR_Flag))
2617 break;
2618 }
2619
2620 udelay(20);
2621 }
2622
rtl8168_ephy_read(struct rtl8168_private * tp,int RegAddr)2623 u16 rtl8168_ephy_read(struct rtl8168_private *tp, int RegAddr)
2624 {
2625 int i;
2626 u16 value = 0xffff;
2627
2628 RTL_W32(tp, EPHYAR,
2629 EPHYAR_Read | (RegAddr & EPHYAR_Reg_Mask) << EPHYAR_Reg_shift);
2630
2631 for (i = 0; i < 10; i++) {
2632 udelay(100);
2633
2634 /* Check if the RTL8168 has completed EPHY read */
2635 if (RTL_R32(tp, EPHYAR) & EPHYAR_Flag) {
2636 value = (u16) (RTL_R32(tp, EPHYAR) & EPHYAR_Data_Mask);
2637 break;
2638 }
2639 }
2640
2641 udelay(20);
2642
2643 return value;
2644 }
2645
ClearAndSetPCIePhyBit(struct rtl8168_private * tp,u8 addr,u16 clearmask,u16 setmask)2646 static void ClearAndSetPCIePhyBit(struct rtl8168_private *tp, u8 addr, u16 clearmask, u16 setmask)
2647 {
2648 u16 EphyValue;
2649
2650 EphyValue = rtl8168_ephy_read(tp, addr);
2651 EphyValue &= ~clearmask;
2652 EphyValue |= setmask;
2653 rtl8168_ephy_write(tp, addr, EphyValue);
2654 }
2655
ClearPCIePhyBit(struct rtl8168_private * tp,u8 addr,u16 mask)2656 static void ClearPCIePhyBit(struct rtl8168_private *tp, u8 addr, u16 mask)
2657 {
2658 ClearAndSetPCIePhyBit( tp,
2659 addr,
2660 mask,
2661 0
2662 );
2663 }
2664
SetPCIePhyBit(struct rtl8168_private * tp,u8 addr,u16 mask)2665 static void SetPCIePhyBit( struct rtl8168_private *tp, u8 addr, u16 mask)
2666 {
2667 ClearAndSetPCIePhyBit( tp,
2668 addr,
2669 0,
2670 mask
2671 );
2672 }
2673
2674 static u32
rtl8168_csi_other_fun_read(struct rtl8168_private * tp,u8 multi_fun_sel_bit,u32 addr)2675 rtl8168_csi_other_fun_read(struct rtl8168_private *tp,
2676 u8 multi_fun_sel_bit,
2677 u32 addr)
2678 {
2679 u32 cmd;
2680 int i;
2681 u32 value = 0;
2682
2683 cmd = CSIAR_Read | CSIAR_ByteEn << CSIAR_ByteEn_shift | (addr & CSIAR_Addr_Mask);
2684
2685 if (tp->mcfg != CFG_METHOD_20 && tp->mcfg != CFG_METHOD_23 &&
2686 tp->mcfg != CFG_METHOD_26 && tp->mcfg != CFG_METHOD_27 &&
2687 tp->mcfg != CFG_METHOD_28 && tp->mcfg != CFG_METHOD_31 &&
2688 tp->mcfg != CFG_METHOD_32 && tp->mcfg != CFG_METHOD_33) {
2689 multi_fun_sel_bit = 0;
2690 }
2691
2692 if ( multi_fun_sel_bit > 7 ) {
2693 return 0xffffffff;
2694 }
2695
2696 cmd |= multi_fun_sel_bit << 16;
2697
2698 RTL_W32(tp, CSIAR, cmd);
2699
2700 for (i = 0; i < 10; i++) {
2701 udelay(100);
2702
2703 /* Check if the RTL8168 has completed CSI read */
2704 if (RTL_R32(tp, CSIAR) & CSIAR_Flag) {
2705 value = (u32)RTL_R32(tp, CSIDR);
2706 break;
2707 }
2708 }
2709
2710 udelay(20);
2711
2712 return value;
2713 }
2714
2715 static void
rtl8168_csi_other_fun_write(struct rtl8168_private * tp,u8 multi_fun_sel_bit,u32 addr,u32 value)2716 rtl8168_csi_other_fun_write(struct rtl8168_private *tp,
2717 u8 multi_fun_sel_bit,
2718 u32 addr,
2719 u32 value)
2720 {
2721 u32 cmd;
2722 int i;
2723
2724 RTL_W32(tp, CSIDR, value);
2725 cmd = CSIAR_Write | CSIAR_ByteEn << CSIAR_ByteEn_shift | (addr & CSIAR_Addr_Mask);
2726 if (tp->mcfg != CFG_METHOD_20 && tp->mcfg != CFG_METHOD_23 &&
2727 tp->mcfg != CFG_METHOD_26 && tp->mcfg != CFG_METHOD_27 &&
2728 tp->mcfg != CFG_METHOD_28 && tp->mcfg != CFG_METHOD_31 &&
2729 tp->mcfg != CFG_METHOD_32 && tp->mcfg != CFG_METHOD_33) {
2730 multi_fun_sel_bit = 0;
2731 }
2732
2733 if ( multi_fun_sel_bit > 7 ) {
2734 return;
2735 }
2736
2737 cmd |= multi_fun_sel_bit << 16;
2738
2739 RTL_W32(tp, CSIAR, cmd);
2740
2741 for (i = 0; i < 10; i++) {
2742 udelay(100);
2743
2744 /* Check if the RTL8168 has completed CSI write */
2745 if (!(RTL_R32(tp, CSIAR) & CSIAR_Flag))
2746 break;
2747 }
2748
2749 udelay(20);
2750 }
2751
2752 static u32
rtl8168_csi_read(struct rtl8168_private * tp,u32 addr)2753 rtl8168_csi_read(struct rtl8168_private *tp,
2754 u32 addr)
2755 {
2756 u8 multi_fun_sel_bit;
2757
2758 if (tp->mcfg == CFG_METHOD_20)
2759 multi_fun_sel_bit = 2;
2760 else if (tp->mcfg == CFG_METHOD_26 || tp->mcfg == CFG_METHOD_31 ||
2761 tp->mcfg == CFG_METHOD_32 || tp->mcfg == CFG_METHOD_33)
2762 multi_fun_sel_bit = 1;
2763 else
2764 multi_fun_sel_bit = 0;
2765
2766 return rtl8168_csi_other_fun_read(tp, multi_fun_sel_bit, addr);
2767 }
2768
2769 static void
rtl8168_csi_write(struct rtl8168_private * tp,u32 addr,u32 value)2770 rtl8168_csi_write(struct rtl8168_private *tp,
2771 u32 addr,
2772 u32 value)
2773 {
2774 u8 multi_fun_sel_bit;
2775
2776 if (tp->mcfg == CFG_METHOD_20)
2777 multi_fun_sel_bit = 2;
2778 else if (tp->mcfg == CFG_METHOD_26 || tp->mcfg == CFG_METHOD_31 ||
2779 tp->mcfg == CFG_METHOD_32 || tp->mcfg == CFG_METHOD_33)
2780 multi_fun_sel_bit = 1;
2781 else
2782 multi_fun_sel_bit = 0;
2783
2784 rtl8168_csi_other_fun_write(tp, multi_fun_sel_bit, addr, value);
2785 }
2786
2787 static u8
rtl8168_csi_fun0_read_byte(struct rtl8168_private * tp,u32 addr)2788 rtl8168_csi_fun0_read_byte(struct rtl8168_private *tp,
2789 u32 addr)
2790 {
2791 u8 RetVal = 0;
2792
2793 if (tp->mcfg == CFG_METHOD_20 || tp->mcfg == CFG_METHOD_26 ||
2794 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
2795 tp->mcfg == CFG_METHOD_33) {
2796 u32 TmpUlong;
2797 u16 RegAlignAddr;
2798 u8 ShiftByte;
2799
2800 RegAlignAddr = addr & ~(0x3);
2801 ShiftByte = addr & (0x3);
2802 TmpUlong = rtl8168_csi_other_fun_read(tp, 0, addr);
2803 TmpUlong >>= (8*ShiftByte);
2804 RetVal = (u8)TmpUlong;
2805 } else {
2806 struct pci_dev *pdev = tp->pci_dev;
2807
2808 pci_read_config_byte(pdev, addr, &RetVal);
2809 }
2810
2811 udelay(20);
2812
2813 return RetVal;
2814 }
2815
2816 static void
rtl8168_csi_fun0_write_byte(struct rtl8168_private * tp,u32 addr,u8 value)2817 rtl8168_csi_fun0_write_byte(struct rtl8168_private *tp,
2818 u32 addr,
2819 u8 value)
2820 {
2821 if (tp->mcfg == CFG_METHOD_20 || tp->mcfg == CFG_METHOD_26 ||
2822 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
2823 tp->mcfg == CFG_METHOD_33) {
2824 u32 TmpUlong;
2825 u16 RegAlignAddr;
2826 u8 ShiftByte;
2827
2828 RegAlignAddr = addr & ~(0x3);
2829 ShiftByte = addr & (0x3);
2830 TmpUlong = rtl8168_csi_other_fun_read(tp, 0, RegAlignAddr);
2831 TmpUlong &= ~(0xFF << (8*ShiftByte));
2832 TmpUlong |= (value << (8*ShiftByte));
2833 rtl8168_csi_other_fun_write( tp, 0, RegAlignAddr, TmpUlong );
2834 } else {
2835 struct pci_dev *pdev = tp->pci_dev;
2836
2837 pci_write_config_byte(pdev, addr, value);
2838 }
2839
2840 udelay(20);
2841 }
2842
2843 static void
rtl8168_clear_and_set_other_fun_pci_bit(struct rtl8168_private * tp,u8 multi_fun_sel_bit,u32 addr,u32 clearmask,u32 setmask)2844 rtl8168_clear_and_set_other_fun_pci_bit(struct rtl8168_private *tp,
2845 u8 multi_fun_sel_bit,
2846 u32 addr,
2847 u32 clearmask,
2848 u32 setmask)
2849 {
2850 u32 TmpUlong;
2851
2852 TmpUlong = rtl8168_csi_other_fun_read(tp, multi_fun_sel_bit, addr);
2853 TmpUlong &= ~clearmask;
2854 TmpUlong |= setmask;
2855 rtl8168_csi_other_fun_write(tp, multi_fun_sel_bit, addr, TmpUlong);
2856 }
2857
2858 static void
rtl8168_other_fun_dev_pci_setting(struct rtl8168_private * tp,u32 addr,u32 clearmask,u32 setmask,u8 multi_fun_sel_bit)2859 rtl8168_other_fun_dev_pci_setting(struct rtl8168_private *tp,
2860 u32 addr,
2861 u32 clearmask,
2862 u32 setmask,
2863 u8 multi_fun_sel_bit)
2864 {
2865 u32 TmpUlong;
2866 u8 i;
2867 u8 FunBit;
2868
2869 for (i = 0; i < 8; i++) {
2870 FunBit = (1 << i);
2871 if (FunBit & multi_fun_sel_bit) {
2872 u8 set_other_fun = TRUE;
2873
2874 switch(tp->mcfg) {
2875 case CFG_METHOD_23:
2876 case CFG_METHOD_27:
2877 case CFG_METHOD_28:
2878 //0: UMAC, 1: TCR1, 2: TCR2, 3: KCS, 4: EHCI(Control by EHCI Driver)
2879 if (i < 5) {
2880 TmpUlong = rtl8168_csi_other_fun_read(tp, i, 0x00);
2881 if (TmpUlong == 0xFFFFFFFF)
2882 set_other_fun = TRUE;
2883 else
2884 set_other_fun = FALSE;
2885 }
2886 break;
2887 case CFG_METHOD_31:
2888 case CFG_METHOD_32:
2889 case CFG_METHOD_33:
2890 //0: BMC, 1: NIC, 2: TCR, 3: VGA/PCIE_TO_USB, 4: EHCI, 5: WIFI, 6: WIFI, 7: KCS
2891 if (i == 5 || i == 6) {
2892 if (tp->DASH) {
2893 TmpUlong = rtl8168_ocp_read(tp, 0x184, 4);
2894 if (TmpUlong & BIT_26)
2895 set_other_fun = FALSE;
2896 else
2897 set_other_fun = TRUE;
2898 }
2899 } else { //function 0/1/2/3/4/7
2900 TmpUlong = rtl8168_csi_other_fun_read(tp, i, 0x00);
2901 if (TmpUlong == 0xFFFFFFFF)
2902 set_other_fun = TRUE;
2903 else
2904 set_other_fun = FALSE;
2905 }
2906 break;
2907 default:
2908 return;
2909 }
2910
2911 if (set_other_fun)
2912 rtl8168_clear_and_set_other_fun_pci_bit(tp, i, addr, clearmask, setmask);
2913 }
2914 }
2915 }
2916
2917 static void
rtl8168_set_dash_other_fun_dev_state_change(struct rtl8168_private * tp,u8 dev_state,u8 multi_fun_sel_bit)2918 rtl8168_set_dash_other_fun_dev_state_change(struct rtl8168_private *tp,
2919 u8 dev_state,
2920 u8 multi_fun_sel_bit)
2921 {
2922 u32 clearmask;
2923 u32 setmask;
2924
2925 if (dev_state == 0) {
2926 //
2927 // goto D0
2928 //
2929 clearmask = (BIT_0 | BIT_1);
2930 setmask = 0;
2931
2932 rtl8168_other_fun_dev_pci_setting(tp, 0x44, clearmask, setmask, multi_fun_sel_bit);
2933 } else {
2934 //
2935 // goto D3
2936 //
2937 clearmask = 0;
2938 setmask = (BIT_0 | BIT_1);
2939
2940 rtl8168_other_fun_dev_pci_setting(tp, 0x44, clearmask, setmask, multi_fun_sel_bit);
2941 }
2942 }
2943
2944 static void
rtl8168_set_dash_other_fun_dev_aspm_clkreq(struct rtl8168_private * tp,u8 aspm_val,u8 clkreq_en,u8 multi_fun_sel_bit)2945 rtl8168_set_dash_other_fun_dev_aspm_clkreq(struct rtl8168_private *tp,
2946 u8 aspm_val,
2947 u8 clkreq_en,
2948 u8 multi_fun_sel_bit)
2949 {
2950 u32 clearmask;
2951 u32 setmask;
2952
2953 aspm_val &= (BIT_0 | BIT_1);
2954 clearmask = (BIT_0 | BIT_1 | BIT_8);
2955 setmask = aspm_val;
2956 if (clkreq_en)
2957 setmask |= BIT_8;
2958
2959 rtl8168_other_fun_dev_pci_setting(tp, 0x80, clearmask, setmask, multi_fun_sel_bit);
2960 }
2961
2962 /*
2963 static void
2964 rtl8168_set_dash_other_fun_dev_pci_cmd_register(struct rtl8168_private *tp,
2965 u8 pci_cmd_reg,
2966 u8 multi_fun_sel_bit)
2967 {
2968 u32 clearmask;
2969 u32 setmask;
2970
2971 pci_cmd_reg &= (BIT_0 | BIT_1 | BIT_2);
2972
2973 clearmask = (BIT_0 | BIT_1 | BIT_2);
2974 setmask = pci_cmd_reg;
2975
2976 rtl8168_other_fun_dev_pci_setting(tp, 0x04, clearmask, setmask, multi_fun_sel_bit);
2977 }
2978 */
2979
rtl8168_eri_read_with_oob_base_address(struct rtl8168_private * tp,int addr,int len,int type,const u32 base_address)2980 u32 rtl8168_eri_read_with_oob_base_address(struct rtl8168_private *tp, int addr, int len, int type, const u32 base_address)
2981 {
2982 int i, val_shift, shift = 0;
2983 u32 value1 = 0, value2 = 0, mask;
2984 u32 eri_cmd;
2985 const u32 transformed_base_address = ((base_address & 0x00FFF000) << 6) | (base_address & 0x000FFF);
2986
2987 if (len > 4 || len <= 0)
2988 return -1;
2989
2990 while (len > 0) {
2991 val_shift = addr % ERIAR_Addr_Align;
2992 addr = addr & ~0x3;
2993
2994 eri_cmd = ERIAR_Read |
2995 transformed_base_address |
2996 type << ERIAR_Type_shift |
2997 ERIAR_ByteEn << ERIAR_ByteEn_shift |
2998 (addr & 0x0FFF);
2999 if (addr & 0xF000) {
3000 u32 tmp;
3001
3002 tmp = addr & 0xF000;
3003 tmp >>= 12;
3004 eri_cmd |= (tmp << 20) & 0x00F00000;
3005 }
3006
3007 RTL_W32(tp, ERIAR, eri_cmd);
3008
3009 for (i = 0; i < 10; i++) {
3010 udelay(100);
3011
3012 /* Check if the RTL8168 has completed ERI read */
3013 if (RTL_R32(tp, ERIAR) & ERIAR_Flag)
3014 break;
3015 }
3016
3017 if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF;
3018 else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF;
3019 else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
3020 else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
3021
3022 value1 = RTL_R32(tp, ERIDR) & mask;
3023 value2 |= (value1 >> val_shift * 8) << shift * 8;
3024
3025 if (len <= 4 - val_shift) {
3026 len = 0;
3027 } else {
3028 len -= (4 - val_shift);
3029 shift = 4 - val_shift;
3030 addr += 4;
3031 }
3032 }
3033
3034 udelay(20);
3035
3036 return value2;
3037 }
3038
rtl8168_eri_read(struct rtl8168_private * tp,int addr,int len,int type)3039 u32 rtl8168_eri_read(struct rtl8168_private *tp, int addr, int len, int type)
3040 {
3041 return rtl8168_eri_read_with_oob_base_address(tp, addr, len, type, 0);
3042 }
3043
rtl8168_eri_write_with_oob_base_address(struct rtl8168_private * tp,int addr,int len,u32 value,int type,const u32 base_address)3044 int rtl8168_eri_write_with_oob_base_address(struct rtl8168_private *tp, int addr, int len, u32 value, int type, const u32 base_address)
3045 {
3046 int i, val_shift, shift = 0;
3047 u32 value1 = 0, mask;
3048 u32 eri_cmd;
3049 const u32 transformed_base_address = ((base_address & 0x00FFF000) << 6) | (base_address & 0x000FFF);
3050
3051 if (len > 4 || len <= 0)
3052 return -1;
3053
3054 while (len > 0) {
3055 val_shift = addr % ERIAR_Addr_Align;
3056 addr = addr & ~0x3;
3057
3058 if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF;
3059 else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF;
3060 else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
3061 else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF;
3062
3063 value1 = rtl8168_eri_read_with_oob_base_address(tp, addr, 4, type, base_address) & ~mask;
3064 value1 |= ((value << val_shift * 8) >> shift * 8);
3065
3066 RTL_W32(tp, ERIDR, value1);
3067
3068 eri_cmd = ERIAR_Write |
3069 transformed_base_address |
3070 type << ERIAR_Type_shift |
3071 ERIAR_ByteEn << ERIAR_ByteEn_shift |
3072 (addr & 0x0FFF);
3073 if (addr & 0xF000) {
3074 u32 tmp;
3075
3076 tmp = addr & 0xF000;
3077 tmp >>= 12;
3078 eri_cmd |= (tmp << 20) & 0x00F00000;
3079 }
3080
3081 RTL_W32(tp, ERIAR, eri_cmd);
3082
3083 for (i = 0; i < 10; i++) {
3084 udelay(100);
3085
3086 /* Check if the RTL8168 has completed ERI write */
3087 if (!(RTL_R32(tp, ERIAR) & ERIAR_Flag))
3088 break;
3089 }
3090
3091 if (len <= 4 - val_shift) {
3092 len = 0;
3093 } else {
3094 len -= (4 - val_shift);
3095 shift = 4 - val_shift;
3096 addr += 4;
3097 }
3098 }
3099
3100 udelay(20);
3101
3102 return 0;
3103 }
3104
rtl8168_eri_write(struct rtl8168_private * tp,int addr,int len,u32 value,int type)3105 int rtl8168_eri_write(struct rtl8168_private *tp, int addr, int len, u32 value, int type)
3106 {
3107 return rtl8168_eri_write_with_oob_base_address(tp, addr, len, value, type, NO_BASE_ADDRESS);
3108 }
3109
3110 static void
rtl8168_enable_rxdvgate(struct net_device * dev)3111 rtl8168_enable_rxdvgate(struct net_device *dev)
3112 {
3113 struct rtl8168_private *tp = netdev_priv(dev);
3114
3115 switch (tp->mcfg) {
3116 case CFG_METHOD_21:
3117 case CFG_METHOD_22:
3118 case CFG_METHOD_23:
3119 case CFG_METHOD_24:
3120 case CFG_METHOD_25:
3121 case CFG_METHOD_26:
3122 case CFG_METHOD_27:
3123 case CFG_METHOD_28:
3124 case CFG_METHOD_29:
3125 case CFG_METHOD_30:
3126 case CFG_METHOD_31:
3127 case CFG_METHOD_32:
3128 case CFG_METHOD_33:
3129 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_3);
3130 mdelay(2);
3131 break;
3132 }
3133 }
3134
3135 static void
rtl8168_disable_rxdvgate(struct net_device * dev)3136 rtl8168_disable_rxdvgate(struct net_device *dev)
3137 {
3138 struct rtl8168_private *tp = netdev_priv(dev);
3139
3140 switch (tp->mcfg) {
3141 case CFG_METHOD_21:
3142 case CFG_METHOD_22:
3143 case CFG_METHOD_23:
3144 case CFG_METHOD_24:
3145 case CFG_METHOD_25:
3146 case CFG_METHOD_26:
3147 case CFG_METHOD_27:
3148 case CFG_METHOD_28:
3149 case CFG_METHOD_29:
3150 case CFG_METHOD_30:
3151 case CFG_METHOD_31:
3152 case CFG_METHOD_32:
3153 case CFG_METHOD_33:
3154 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_3);
3155 mdelay(2);
3156 break;
3157 }
3158 }
3159
3160 static u8
rtl8168_is_gpio_low(struct net_device * dev)3161 rtl8168_is_gpio_low(struct net_device *dev)
3162 {
3163 struct rtl8168_private *tp = netdev_priv(dev);
3164 u8 gpio_low = FALSE;
3165
3166 switch (tp->HwSuppCheckPhyDisableModeVer) {
3167 case 1:
3168 case 2:
3169 if (!(rtl8168_mac_ocp_read(tp, 0xDC04) & BIT_9))
3170 gpio_low = TRUE;
3171 break;
3172 case 3:
3173 if (!(rtl8168_mac_ocp_read(tp, 0xDC04) & BIT_13))
3174 gpio_low = TRUE;
3175 break;
3176 }
3177
3178 if (gpio_low)
3179 dprintk("gpio is low.\n");
3180
3181 return gpio_low;
3182 }
3183
3184 static u8
rtl8168_is_phy_disable_mode_enabled(struct net_device * dev)3185 rtl8168_is_phy_disable_mode_enabled(struct net_device *dev)
3186 {
3187 struct rtl8168_private *tp = netdev_priv(dev);
3188 u8 phy_disable_mode_enabled = FALSE;
3189
3190 switch (tp->HwSuppCheckPhyDisableModeVer) {
3191 case 1:
3192 if (rtl8168_mac_ocp_read(tp, 0xDC20) & BIT_1)
3193 phy_disable_mode_enabled = TRUE;
3194 break;
3195 case 2:
3196 case 3:
3197 if (RTL_R8(tp, 0xF2) & BIT_5)
3198 phy_disable_mode_enabled = TRUE;
3199 break;
3200 }
3201
3202 if (phy_disable_mode_enabled)
3203 dprintk("phy disable mode enabled.\n");
3204
3205 return phy_disable_mode_enabled;
3206 }
3207
3208 static u8
rtl8168_is_in_phy_disable_mode(struct net_device * dev)3209 rtl8168_is_in_phy_disable_mode(struct net_device *dev)
3210 {
3211 u8 in_phy_disable_mode = FALSE;
3212
3213 if (rtl8168_is_phy_disable_mode_enabled(dev) && rtl8168_is_gpio_low(dev))
3214 in_phy_disable_mode = TRUE;
3215
3216 if (in_phy_disable_mode)
3217 dprintk("Hardware is in phy disable mode.\n");
3218
3219 return in_phy_disable_mode;
3220 }
3221
3222 void
rtl8168_wait_txrx_fifo_empty(struct net_device * dev)3223 rtl8168_wait_txrx_fifo_empty(struct net_device *dev)
3224 {
3225 struct rtl8168_private *tp = netdev_priv(dev);
3226 int i;
3227
3228 switch (tp->mcfg) {
3229 case CFG_METHOD_21:
3230 case CFG_METHOD_22:
3231 case CFG_METHOD_23:
3232 case CFG_METHOD_24:
3233 case CFG_METHOD_25:
3234 case CFG_METHOD_26:
3235 case CFG_METHOD_27:
3236 case CFG_METHOD_28:
3237 case CFG_METHOD_29:
3238 case CFG_METHOD_30:
3239 case CFG_METHOD_31:
3240 case CFG_METHOD_32:
3241 case CFG_METHOD_33:
3242 for (i = 0; i < 10; i++) {
3243 udelay(100);
3244 if (RTL_R32(tp, TxConfig) & BIT_11)
3245 break;
3246 }
3247
3248 for (i = 0; i < 10; i++) {
3249 udelay(100);
3250 if ((RTL_R8(tp, MCUCmd_reg) & (Txfifo_empty | Rxfifo_empty)) == (Txfifo_empty | Rxfifo_empty))
3251 break;
3252 }
3253
3254 mdelay(1);
3255 break;
3256 }
3257 }
3258
rtl8168_driver_start(struct rtl8168_private * tp)3259 static void rtl8168_driver_start(struct rtl8168_private *tp)
3260 {
3261 //change other device state to D0.
3262 switch (tp->mcfg) {
3263 case CFG_METHOD_23:
3264 case CFG_METHOD_27:
3265 case CFG_METHOD_28:
3266 rtl8168_set_dash_other_fun_dev_aspm_clkreq(tp, 3, 1, 0x1E);
3267 rtl8168_set_dash_other_fun_dev_state_change(tp, 3, 0x1E);
3268 break;
3269 case CFG_METHOD_31:
3270 case CFG_METHOD_32:
3271 case CFG_METHOD_33:
3272 rtl8168_set_dash_other_fun_dev_aspm_clkreq(tp, 3, 1, 0xFC);
3273 rtl8168_set_dash_other_fun_dev_state_change(tp, 3, 0xFC);
3274 break;
3275 }
3276
3277 if (!tp->DASH)
3278 return;
3279
3280 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
3281 int timeout;
3282 u32 tmp_value;
3283
3284 rtl8168_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_START);
3285 tmp_value = rtl8168_ocp_read(tp, 0x30, 1);
3286 tmp_value |= BIT_0;
3287 rtl8168_ocp_write(tp, 0x30, 1, tmp_value);
3288
3289 for (timeout = 0; timeout < 10; timeout++) {
3290 mdelay(10);
3291 if (rtl8168_ocp_read(tp, 0x124, 1) & BIT_0)
3292 break;
3293 }
3294 } else {
3295 int timeout;
3296 u32 reg;
3297
3298 if (tp->mcfg == CFG_METHOD_13) {
3299 RTL_W8(tp, TwiCmdReg, RTL_R8(tp, TwiCmdReg) | ( BIT_7 ));
3300 }
3301
3302 rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START);
3303
3304 if (tp->mcfg == CFG_METHOD_13)
3305 reg = 0xB8;
3306 else
3307 reg = 0x10;
3308
3309 for (timeout = 0; timeout < 10; timeout++) {
3310 mdelay(10);
3311 if (rtl8168_ocp_read(tp, reg, 2) & BIT_11)
3312 break;
3313 }
3314 }
3315 }
3316
rtl8168_driver_stop(struct rtl8168_private * tp)3317 static void rtl8168_driver_stop(struct rtl8168_private *tp)
3318 {
3319 if (!tp->DASH)
3320 goto update_device_state;
3321
3322 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
3323 struct net_device *dev = tp->dev;
3324 int timeout;
3325 u32 tmp_value;
3326
3327 rtl8168_dash2_disable_txrx(dev);
3328
3329 rtl8168_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_STOP);
3330 tmp_value = rtl8168_ocp_read(tp, 0x30, 1);
3331 tmp_value |= BIT_0;
3332 rtl8168_ocp_write(tp, 0x30, 1, tmp_value);
3333
3334 for (timeout = 0; timeout < 10; timeout++) {
3335 mdelay(10);
3336 if (!(rtl8168_ocp_read(tp, 0x124, 1) & BIT_0))
3337 break;
3338 }
3339 } else {
3340 int timeout;
3341 u32 reg;
3342
3343 rtl8168_oob_notify(tp, OOB_CMD_DRIVER_STOP);
3344
3345 if (tp->mcfg == CFG_METHOD_13)
3346 reg = 0xB8;
3347 else
3348 reg = 0x10;
3349
3350 for (timeout = 0; timeout < 10; timeout++) {
3351 mdelay(10);
3352 if ((rtl8168_ocp_read(tp, reg, 2) & BIT_11) == 0)
3353 break;
3354 }
3355
3356 if (tp->mcfg == CFG_METHOD_13) {
3357 RTL_W8(tp, TwiCmdReg, RTL_R8(tp, TwiCmdReg) & ~( BIT_7 ));
3358 }
3359 }
3360
3361 update_device_state:
3362 //change other device state to D3.
3363 switch (tp->mcfg) {
3364 case CFG_METHOD_23:
3365 case CFG_METHOD_27:
3366 case CFG_METHOD_28:
3367 rtl8168_set_dash_other_fun_dev_state_change(tp, 3, 0x0E);
3368 break;
3369 case CFG_METHOD_31:
3370 case CFG_METHOD_32:
3371 case CFG_METHOD_33:
3372 rtl8168_set_dash_other_fun_dev_state_change(tp, 3, 0xFD);
3373 break;
3374 }
3375 }
3376
3377 #ifdef ENABLE_DASH_SUPPORT
3378
3379 inline void
rtl8168_enable_dash2_interrupt(struct rtl8168_private * tp)3380 rtl8168_enable_dash2_interrupt(struct rtl8168_private *tp)
3381 {
3382 if (!tp->DASH) return;
3383
3384 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
3385 RTL_CMAC_W8(tp, CMAC_IBIMR0, ( ISRIMR_DASH_TYPE2_ROK | ISRIMR_DASH_TYPE2_TOK | ISRIMR_DASH_TYPE2_TDU | ISRIMR_DASH_TYPE2_RDU | ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE ));
3386 }
3387 }
3388
3389 static inline void
rtl8168_disable_dash2_interrupt(struct rtl8168_private * tp)3390 rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp)
3391 {
3392 if (!tp->DASH) return;
3393
3394 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
3395 RTL_CMAC_W8(tp, CMAC_IBIMR0, 0);
3396 }
3397 }
3398 #endif
3399
3400 static inline void
rtl8168_enable_hw_interrupt(struct rtl8168_private * tp)3401 rtl8168_enable_hw_interrupt(struct rtl8168_private *tp)
3402 {
3403 RTL_W16(tp, IntrMask, tp->intr_mask);
3404
3405 #ifdef ENABLE_DASH_SUPPORT
3406 if (tp->DASH)
3407 rtl8168_enable_dash2_interrupt(tp);
3408 #endif
3409 }
3410
3411 static inline void
rtl8168_disable_hw_interrupt(struct rtl8168_private * tp)3412 rtl8168_disable_hw_interrupt(struct rtl8168_private *tp)
3413 {
3414 RTL_W16(tp, IntrMask, 0x0000);
3415
3416 #ifdef ENABLE_DASH_SUPPORT
3417 if (tp->DASH)
3418 rtl8168_disable_dash2_interrupt(tp);
3419 #endif
3420 }
3421
3422
3423 static inline void
rtl8168_switch_to_hw_interrupt(struct rtl8168_private * tp)3424 rtl8168_switch_to_hw_interrupt(struct rtl8168_private *tp)
3425 {
3426 RTL_W32(tp, TimeInt0, 0x0000);
3427
3428 rtl8168_enable_hw_interrupt(tp);
3429 }
3430
3431 static inline void
rtl8168_switch_to_timer_interrupt(struct rtl8168_private * tp)3432 rtl8168_switch_to_timer_interrupt(struct rtl8168_private *tp)
3433 {
3434 if (tp->use_timer_interrrupt) {
3435 RTL_W32(tp, TimeInt0, timer_count);
3436 RTL_W32(tp, TCTR, timer_count);
3437 RTL_W16(tp, IntrMask, tp->timer_intr_mask);
3438
3439 #ifdef ENABLE_DASH_SUPPORT
3440 if (tp->DASH)
3441 rtl8168_enable_dash2_interrupt(tp);
3442 #endif
3443 } else {
3444 rtl8168_switch_to_hw_interrupt(tp);
3445 }
3446 }
3447
3448 static void
rtl8168_irq_mask_and_ack(struct rtl8168_private * tp)3449 rtl8168_irq_mask_and_ack(struct rtl8168_private *tp)
3450 {
3451 rtl8168_disable_hw_interrupt(tp);
3452 #ifdef ENABLE_DASH_SUPPORT
3453 if (tp->DASH) {
3454 if (tp->dash_printer_enabled) {
3455 RTL_W16(tp, IntrStatus, RTL_R16(tp, IntrStatus) &
3456 ~(ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET));
3457 } else {
3458 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
3459 RTL_CMAC_W8(tp, CMAC_IBISR0, RTL_CMAC_R8(tp, CMAC_IBISR0));
3460 }
3461 }
3462 } else {
3463 RTL_W16(tp, IntrStatus, RTL_R16(tp, IntrStatus));
3464 }
3465 #else
3466 RTL_W16(tp, IntrStatus, RTL_R16(tp, IntrStatus));
3467 #endif
3468 }
3469
3470 static void
rtl8168_nic_reset(struct net_device * dev)3471 rtl8168_nic_reset(struct net_device *dev)
3472 {
3473 struct rtl8168_private *tp = netdev_priv(dev);
3474 int i;
3475
3476 RTL_W32(tp, RxConfig, (RX_DMA_BURST << RxCfgDMAShift));
3477
3478 rtl8168_enable_rxdvgate(dev);
3479
3480 switch (tp->mcfg) {
3481 case CFG_METHOD_1:
3482 case CFG_METHOD_2:
3483 case CFG_METHOD_3:
3484 mdelay(10);
3485 break;
3486 case CFG_METHOD_4:
3487 case CFG_METHOD_5:
3488 case CFG_METHOD_6:
3489 case CFG_METHOD_7:
3490 case CFG_METHOD_8:
3491 case CFG_METHOD_9:
3492 case CFG_METHOD_10:
3493 case CFG_METHOD_14:
3494 case CFG_METHOD_15:
3495 RTL_W8(tp, ChipCmd, StopReq | CmdRxEnb | CmdTxEnb);
3496 udelay(100);
3497 break;
3498 case CFG_METHOD_11:
3499 case CFG_METHOD_12:
3500 case CFG_METHOD_13:
3501 for (i = 0; i < 2000; i++) {
3502 if (!(RTL_R8(tp, TxPoll) & NPQ)) break;
3503 udelay(100);
3504 }
3505 break;
3506 case CFG_METHOD_21:
3507 case CFG_METHOD_22:
3508 case CFG_METHOD_23:
3509 case CFG_METHOD_24:
3510 case CFG_METHOD_25:
3511 case CFG_METHOD_26:
3512 case CFG_METHOD_27:
3513 case CFG_METHOD_28:
3514 case CFG_METHOD_29:
3515 case CFG_METHOD_30:
3516 case CFG_METHOD_31:
3517 case CFG_METHOD_32:
3518 case CFG_METHOD_33:
3519 mdelay(2);
3520 break;
3521 default:
3522 mdelay(10);
3523 break;
3524 }
3525
3526 rtl8168_wait_txrx_fifo_empty(dev);
3527
3528 /* Soft reset the chip. */
3529 RTL_W8(tp, ChipCmd, CmdReset);
3530
3531 /* Check that the chip has finished the reset. */
3532 for (i = 100; i > 0; i--) {
3533 udelay(100);
3534 if ((RTL_R8(tp, ChipCmd) & CmdReset) == 0)
3535 break;
3536 }
3537
3538 switch (tp->mcfg) {
3539 case CFG_METHOD_11:
3540 rtl8168_oob_mutex_lock(tp);
3541 rtl8168_ocp_write(tp, 0x10, 2, rtl8168_ocp_read(tp, 0x010, 2)&~0x00004000);
3542 rtl8168_oob_mutex_unlock(tp);
3543
3544 rtl8168_oob_notify(tp, OOB_CMD_RESET);
3545
3546 for (i = 0; i < 10; i++) {
3547 mdelay(10);
3548 if (rtl8168_ocp_read(tp, 0x010, 2)&0x00004000)
3549 break;
3550 }
3551
3552 for (i = 0; i < 5; i++) {
3553 if ( rtl8168_ocp_read(tp, 0x034, 1) == 0)
3554 break;
3555 }
3556 break;
3557 }
3558 }
3559
3560 static void
rtl8168_hw_clear_timer_int(struct net_device * dev)3561 rtl8168_hw_clear_timer_int(struct net_device *dev)
3562 {
3563 struct rtl8168_private *tp = netdev_priv(dev);
3564
3565 RTL_W32(tp, TimeInt0, 0x0000);
3566
3567 switch (tp->mcfg) {
3568 case CFG_METHOD_4:
3569 case CFG_METHOD_5:
3570 case CFG_METHOD_6:
3571 case CFG_METHOD_7:
3572 case CFG_METHOD_8:
3573 RTL_W32(tp, TimeInt1, 0x0000);
3574 break;
3575 case CFG_METHOD_9:
3576 case CFG_METHOD_10:
3577 case CFG_METHOD_11:
3578 case CFG_METHOD_12:
3579 case CFG_METHOD_13:
3580 case CFG_METHOD_14:
3581 case CFG_METHOD_15:
3582 case CFG_METHOD_16:
3583 case CFG_METHOD_17:
3584 case CFG_METHOD_18:
3585 case CFG_METHOD_19:
3586 case CFG_METHOD_20:
3587 case CFG_METHOD_21:
3588 case CFG_METHOD_22:
3589 case CFG_METHOD_23:
3590 case CFG_METHOD_24:
3591 case CFG_METHOD_25:
3592 case CFG_METHOD_26:
3593 case CFG_METHOD_27:
3594 case CFG_METHOD_28:
3595 case CFG_METHOD_29:
3596 case CFG_METHOD_30:
3597 case CFG_METHOD_31:
3598 case CFG_METHOD_32:
3599 case CFG_METHOD_33:
3600 RTL_W32(tp, TimeInt1, 0x0000);
3601 RTL_W32(tp, TimeInt2, 0x0000);
3602 RTL_W32(tp, TimeInt3, 0x0000);
3603 break;
3604 }
3605 }
3606
3607 static void
rtl8168_hw_reset(struct net_device * dev)3608 rtl8168_hw_reset(struct net_device *dev)
3609 {
3610 struct rtl8168_private *tp = netdev_priv(dev);
3611
3612 /* Disable interrupts */
3613 rtl8168_irq_mask_and_ack(tp);
3614
3615 rtl8168_hw_clear_timer_int(dev);
3616
3617 rtl8168_nic_reset(dev);
3618 }
3619
rtl8168_mac_loopback_test(struct rtl8168_private * tp)3620 static void rtl8168_mac_loopback_test(struct rtl8168_private *tp)
3621 {
3622 struct pci_dev *pdev = tp->pci_dev;
3623 struct net_device *dev = tp->dev;
3624 struct sk_buff *skb, *rx_skb;
3625 dma_addr_t mapping;
3626 struct TxDesc *txd;
3627 struct RxDesc *rxd;
3628 void *tmpAddr;
3629 u32 len, rx_len, rx_cmd = 0;
3630 u16 type;
3631 u8 pattern;
3632 int i;
3633
3634 if (tp->DASH)
3635 return;
3636
3637 pattern = 0x5A;
3638 len = 60;
3639 type = htons(ETH_P_IP);
3640 txd = tp->TxDescArray;
3641 rxd = tp->RxDescArray;
3642 rx_skb = tp->Rx_skbuff[0];
3643 RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) & ~0x00060000) | 0x00020000);
3644
3645 do {
3646 skb = dev_alloc_skb(len + RTK_RX_ALIGN);
3647 if (unlikely(!skb))
3648 dev_printk(KERN_NOTICE, tp_to_dev(tp), "-ENOMEM;\n");
3649 } while (unlikely(skb == NULL));
3650 skb_reserve(skb, RTK_RX_ALIGN);
3651
3652 memcpy(skb_put(skb, dev->addr_len), dev->dev_addr, dev->addr_len);
3653 memcpy(skb_put(skb, dev->addr_len), dev->dev_addr, dev->addr_len);
3654 memcpy(skb_put(skb, sizeof(type)), &type, sizeof(type));
3655 tmpAddr = skb_put(skb, len - 14);
3656
3657 mapping = dma_map_single(tp_to_dev(tp), skb->data, len, DMA_TO_DEVICE);
3658 dma_sync_single_for_cpu(tp_to_dev(tp), le64_to_cpu(mapping),
3659 len, DMA_TO_DEVICE);
3660 txd->addr = cpu_to_le64(mapping);
3661 txd->opts2 = 0;
3662 while (1) {
3663 memset(tmpAddr, pattern++, len - 14);
3664 pci_dma_sync_single_for_device(tp->pci_dev,
3665 le64_to_cpu(mapping),
3666 len, DMA_TO_DEVICE);
3667 txd->opts1 = cpu_to_le32(DescOwn | FirstFrag | LastFrag | len);
3668
3669 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptMyPhys);
3670
3671 smp_wmb();
3672 RTL_W8(tp, TxPoll, NPQ); /* set polling bit */
3673
3674 for (i = 0; i < 50; i++) {
3675 udelay(200);
3676 rx_cmd = le32_to_cpu(rxd->opts1);
3677 if ((rx_cmd & DescOwn) == 0)
3678 break;
3679 }
3680
3681 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(AcceptErr | AcceptRunt | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys));
3682
3683 rx_len = rx_cmd & 0x3FFF;
3684 rx_len -= 4;
3685 rxd->opts1 = cpu_to_le32(DescOwn | tp->rx_buf_sz);
3686
3687 dma_sync_single_for_cpu(tp_to_dev(tp), le64_to_cpu(mapping), len, DMA_TO_DEVICE);
3688
3689 if (rx_len == len) {
3690 dma_sync_single_for_cpu(tp_to_dev(tp), le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
3691 i = memcmp(skb->data, rx_skb->data, rx_len);
3692 pci_dma_sync_single_for_device(tp->pci_dev, le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
3693 if (i == 0) {
3694 // dev_printk(KERN_INFO, tp_to_dev(tp), "loopback test finished\n",rx_len,len);
3695 break;
3696 }
3697 }
3698
3699 rtl8168_hw_reset(dev);
3700 rtl8168_disable_rxdvgate(dev);
3701 RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb);
3702 }
3703 tp->dirty_tx++;
3704 tp->dirty_rx++;
3705 tp->cur_tx++;
3706 tp->cur_rx++;
3707 dma_unmap_single(&pdev->dev, le64_to_cpu(mapping),
3708 len, DMA_TO_DEVICE);
3709 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) & ~0x00060000);
3710 dev_kfree_skb_any(skb);
3711 RTL_W16(tp, IntrStatus, 0xFFBF);
3712 }
3713
3714 static unsigned int
rtl8168_xmii_reset_pending(struct net_device * dev)3715 rtl8168_xmii_reset_pending(struct net_device *dev)
3716 {
3717 struct rtl8168_private *tp = netdev_priv(dev);
3718 unsigned int retval;
3719
3720 rtl8168_mdio_write(tp, 0x1f, 0x0000);
3721 retval = rtl8168_mdio_read(tp, MII_BMCR) & BMCR_RESET;
3722
3723 return retval;
3724 }
3725
3726 static unsigned int
rtl8168_xmii_link_ok(struct net_device * dev)3727 rtl8168_xmii_link_ok(struct net_device *dev)
3728 {
3729 struct rtl8168_private *tp = netdev_priv(dev);
3730 unsigned int retval;
3731
3732 retval = (RTL_R8(tp, PHYstatus) & LinkStatus) ? 1 : 0;
3733
3734 return retval;
3735 }
3736
3737 static int
rtl8168_wait_phy_reset_complete(struct rtl8168_private * tp)3738 rtl8168_wait_phy_reset_complete(struct rtl8168_private *tp)
3739 {
3740 int i, val;
3741
3742 for (i = 0; i < 2500; i++) {
3743 val = rtl8168_mdio_read(tp, MII_BMCR) & BMCR_RESET;
3744 if (!val)
3745 return 0;
3746
3747 mdelay(1);
3748 }
3749
3750 return -1;
3751 }
3752
3753 static void
rtl8168_xmii_reset_enable(struct net_device * dev)3754 rtl8168_xmii_reset_enable(struct net_device *dev)
3755 {
3756 struct rtl8168_private *tp = netdev_priv(dev);
3757
3758 if (rtl8168_is_in_phy_disable_mode(dev))
3759 return;
3760
3761 rtl8168_mdio_write(tp, 0x1f, 0x0000);
3762 rtl8168_mdio_write(tp, MII_ADVERTISE, rtl8168_mdio_read(tp, MII_ADVERTISE) &
3763 ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
3764 ADVERTISE_100HALF | ADVERTISE_100FULL));
3765 rtl8168_mdio_write(tp, MII_CTRL1000, rtl8168_mdio_read(tp, MII_CTRL1000) &
3766 ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL));
3767 rtl8168_mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE);
3768
3769 if (rtl8168_wait_phy_reset_complete(tp) == 0) return;
3770
3771 if (netif_msg_link(tp))
3772 printk(KERN_ERR "%s: PHY reset failed.\n", dev->name);
3773 }
3774
3775 static void
rtl8168dp_10mbps_gphy_para(struct net_device * dev)3776 rtl8168dp_10mbps_gphy_para(struct net_device *dev)
3777 {
3778 struct rtl8168_private *tp = netdev_priv(dev);
3779 u8 status = RTL_R8(tp, PHYstatus);
3780
3781 if ((status & LinkStatus) && (status & _10bps)) {
3782 rtl8168_mdio_write(tp, 0x1f, 0x0000);
3783 rtl8168_mdio_write(tp, 0x10, 0x04EE);
3784 } else {
3785 rtl8168_mdio_write(tp, 0x1f, 0x0000);
3786 rtl8168_mdio_write(tp, 0x10, 0x01EE);
3787 }
3788 }
3789
rtl8168_init_ring_indexes(struct rtl8168_private * tp)3790 void rtl8168_init_ring_indexes(struct rtl8168_private *tp)
3791 {
3792 tp->dirty_tx = 0;
3793 tp->dirty_rx = 0;
3794 tp->cur_tx = 0;
3795 tp->cur_rx = 0;
3796 }
3797
3798 static void
rtl8168_issue_offset_99_event(struct rtl8168_private * tp)3799 rtl8168_issue_offset_99_event(struct rtl8168_private *tp)
3800 {
3801 u32 csi_tmp;
3802
3803 switch (tp->mcfg) {
3804 case CFG_METHOD_21:
3805 case CFG_METHOD_22:
3806 case CFG_METHOD_23:
3807 case CFG_METHOD_24:
3808 case CFG_METHOD_25:
3809 case CFG_METHOD_27:
3810 case CFG_METHOD_28:
3811 if (tp->mcfg == CFG_METHOD_24 || tp->mcfg == CFG_METHOD_25 ||
3812 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28) {
3813 rtl8168_eri_write(tp, 0x3FC, 4, 0x00000000, ERIAR_ExGMAC);
3814 } else {
3815 rtl8168_eri_write(tp, 0x3FC, 4, 0x083C083C, ERIAR_ExGMAC);
3816 }
3817 csi_tmp = rtl8168_eri_read(tp, 0x3F8, 1, ERIAR_ExGMAC);
3818 csi_tmp |= BIT_0;
3819 rtl8168_eri_write(tp, 0x3F8, 1, csi_tmp, ERIAR_ExGMAC);
3820 break;
3821 case CFG_METHOD_29:
3822 case CFG_METHOD_30:
3823 case CFG_METHOD_31:
3824 case CFG_METHOD_32:
3825 case CFG_METHOD_33:
3826 csi_tmp = rtl8168_eri_read(tp, 0x1EA, 1, ERIAR_ExGMAC);
3827 csi_tmp |= BIT_0;
3828 rtl8168_eri_write(tp, 0x1EA, 1, csi_tmp, ERIAR_ExGMAC);
3829 break;
3830 }
3831 }
3832
3833 static void
rtl8168_enable_cfg9346_write(struct rtl8168_private * tp)3834 rtl8168_enable_cfg9346_write(struct rtl8168_private *tp)
3835 {
3836 RTL_W8(tp, Cfg9346, RTL_R8(tp, Cfg9346) | Cfg9346_Unlock);
3837 }
3838
3839 static void
rtl8168_disable_cfg9346_write(struct rtl8168_private * tp)3840 rtl8168_disable_cfg9346_write(struct rtl8168_private *tp)
3841 {
3842 RTL_W8(tp, Cfg9346, RTL_R8(tp, Cfg9346) & ~Cfg9346_Unlock);
3843 }
3844
3845 static void
rtl8168_enable_exit_l1_mask(struct rtl8168_private * tp)3846 rtl8168_enable_exit_l1_mask(struct rtl8168_private *tp)
3847 {
3848 u32 csi_tmp;
3849
3850 switch (tp->mcfg) {
3851 case CFG_METHOD_16:
3852 case CFG_METHOD_17:
3853 case CFG_METHOD_18:
3854 case CFG_METHOD_19:
3855 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
3856 csi_tmp |= (BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12);
3857 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
3858 break;
3859 case CFG_METHOD_20:
3860 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
3861 csi_tmp |= (BIT_10 | BIT_11);
3862 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
3863 break;
3864 case CFG_METHOD_21 ... CFG_METHOD_33:
3865 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
3866 csi_tmp |= (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12);
3867 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
3868 break;
3869 }
3870 }
3871
3872 static void
rtl8168_disable_exit_l1_mask(struct rtl8168_private * tp)3873 rtl8168_disable_exit_l1_mask(struct rtl8168_private *tp)
3874 {
3875 u32 csi_tmp;
3876
3877 switch (tp->mcfg) {
3878 case CFG_METHOD_16:
3879 case CFG_METHOD_17:
3880 case CFG_METHOD_18:
3881 case CFG_METHOD_19:
3882 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
3883 csi_tmp &= ~(BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12);
3884 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
3885 break;
3886 case CFG_METHOD_20:
3887 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
3888 csi_tmp &= ~(BIT_10 | BIT_11);
3889 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
3890 break;
3891 case CFG_METHOD_21 ... CFG_METHOD_33:
3892 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
3893 csi_tmp &= ~(BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12);
3894 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
3895 break;
3896 }
3897 }
3898
3899 static void
rtl8168_hw_aspm_clkreq_enable(struct rtl8168_private * tp,bool enable)3900 rtl8168_hw_aspm_clkreq_enable(struct rtl8168_private *tp, bool enable)
3901 {
3902 if (!tp->HwSuppAspmClkIntrLock) return;
3903
3904 if (enable && aspm) {
3905 RTL_W8(tp, Config5, RTL_R8(tp, Config5) | ASPM_en);
3906 RTL_W8(tp, Config2, RTL_R8(tp, Config2) | ClkReqEn);
3907 } else {
3908 RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~ClkReqEn);
3909 RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~ASPM_en);
3910 }
3911
3912 udelay(10);
3913 }
3914
3915 #ifdef ENABLE_DASH_SUPPORT
3916 static void
NICChkTypeEnableDashInterrupt(struct rtl8168_private * tp)3917 NICChkTypeEnableDashInterrupt(struct rtl8168_private *tp)
3918 {
3919 if (tp->DASH) {
3920 //
3921 // even disconnected, enable 3 dash interrupt mask bits for in-band/out-band communication
3922 //
3923 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
3924 rtl8168_enable_dash2_interrupt(tp);
3925 RTL_W16(tp, IntrMask, (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET));
3926 } else {
3927 RTL_W16(tp, IntrMask, (ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK));
3928 }
3929 }
3930 }
3931 #endif
3932
3933 static void
rtl8168_check_link_status(struct net_device * dev)3934 rtl8168_check_link_status(struct net_device *dev)
3935 {
3936 struct rtl8168_private *tp = netdev_priv(dev);
3937 int link_status_on;
3938
3939 #ifdef ENABLE_FIBER_SUPPORT
3940 rtl8168_check_fiber_link_status(dev);
3941 #endif //ENABLE_FIBER_SUPPORT
3942
3943 link_status_on = tp->link_ok(dev);
3944
3945 if (tp->mcfg == CFG_METHOD_11)
3946 rtl8168dp_10mbps_gphy_para(dev);
3947
3948 if (netif_carrier_ok(dev) != link_status_on) {
3949 if (link_status_on) {
3950 rtl8168_hw_config(dev);
3951
3952 if (tp->mcfg == CFG_METHOD_18 || tp->mcfg == CFG_METHOD_19 || tp->mcfg == CFG_METHOD_20) {
3953 if (RTL_R8(tp, PHYstatus) & _1000bpsF) {
3954 rtl8168_eri_write(tp, 0x1bc, 4, 0x00000011, ERIAR_ExGMAC);
3955 rtl8168_eri_write(tp, 0x1dc, 4, 0x0000001f, ERIAR_ExGMAC);
3956 } else if (RTL_R8(tp, PHYstatus) & _100bps) {
3957 rtl8168_eri_write(tp, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC);
3958 rtl8168_eri_write(tp, 0x1dc, 4, 0x0000001f, ERIAR_ExGMAC);
3959 } else {
3960 rtl8168_eri_write(tp, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC);
3961 rtl8168_eri_write(tp, 0x1dc, 4, 0x0000002d, ERIAR_ExGMAC);
3962 }
3963 } else if ((tp->mcfg == CFG_METHOD_16 || tp->mcfg == CFG_METHOD_17) && netif_running(dev)) {
3964 if (tp->mcfg == CFG_METHOD_16 && (RTL_R8(tp, PHYstatus) & _10bps)) {
3965 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptAllPhys);
3966 } else if (tp->mcfg == CFG_METHOD_17) {
3967 if (RTL_R8(tp, PHYstatus) & _1000bpsF) {
3968 rtl8168_eri_write(tp, 0x1bc, 4, 0x00000011, ERIAR_ExGMAC);
3969 rtl8168_eri_write(tp, 0x1dc, 4, 0x00000005, ERIAR_ExGMAC);
3970 } else if (RTL_R8(tp, PHYstatus) & _100bps) {
3971 rtl8168_eri_write(tp, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC);
3972 rtl8168_eri_write(tp, 0x1dc, 4, 0x00000005, ERIAR_ExGMAC);
3973 } else {
3974 rtl8168_eri_write(tp, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC);
3975 rtl8168_eri_write(tp, 0x1dc, 4, 0x0000003f, ERIAR_ExGMAC);
3976 }
3977 }
3978 } else if ((tp->mcfg == CFG_METHOD_14 || tp->mcfg == CFG_METHOD_15) && tp->eee_enabled == 1) {
3979 /*Full -Duplex mode*/
3980 if (RTL_R8(tp, PHYstatus)&FullDup) {
3981 rtl8168_mdio_write(tp, 0x1F, 0x0006);
3982 rtl8168_mdio_write(tp, 0x00, 0x5a30);
3983 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3984 if (RTL_R8(tp, PHYstatus) & (_10bps | _100bps))
3985 RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) & ~BIT_19) | BIT_25);
3986
3987 } else {
3988 rtl8168_mdio_write(tp, 0x1F, 0x0006);
3989 rtl8168_mdio_write(tp, 0x00, 0x5a00);
3990 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3991 if (RTL_R8(tp, PHYstatus) & (_10bps | _100bps))
3992 RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) & ~BIT_19) | (InterFrameGap << TxInterFrameGapShift));
3993 }
3994 } else if ((tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
3995 tp->mcfg == CFG_METHOD_23 || tp->mcfg == CFG_METHOD_24 ||
3996 tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
3997 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
3998 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
3999 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4000 tp->mcfg == CFG_METHOD_33) && netif_running(dev)) {
4001 if (RTL_R8(tp, PHYstatus)&FullDup)
4002 RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | (BIT_24 | BIT_25)) & ~BIT_19);
4003 else
4004 RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | BIT_25) & ~(BIT_19 | BIT_24));
4005 }
4006
4007 if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
4008 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
4009 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4010 tp->mcfg == CFG_METHOD_33) {
4011 /*half mode*/
4012 if (!(RTL_R8(tp, PHYstatus)&FullDup)) {
4013 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4014 rtl8168_mdio_write(tp, MII_ADVERTISE, rtl8168_mdio_read(tp, MII_ADVERTISE)&~(ADVERTISE_PAUSE_CAP|ADVERTISE_PAUSE_ASYM));
4015 }
4016 }
4017
4018 if ((tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4019 tp->mcfg == CFG_METHOD_33) && (RTL_R8(tp, PHYstatus) & _10bps)) {
4020 u32 csi_tmp;
4021
4022 csi_tmp = rtl8168_eri_read(tp, 0x1D0, 1, ERIAR_ExGMAC);
4023 csi_tmp |= BIT_1;
4024 rtl8168_eri_write(tp, 0x1D0, 1, csi_tmp, ERIAR_ExGMAC);
4025 }
4026
4027 rtl8168_hw_start(dev);
4028
4029 netif_carrier_on(dev);
4030
4031 netif_wake_queue(dev);
4032
4033 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4034 tp->phy_reg_aner = rtl8168_mdio_read(tp, MII_EXPANSION);
4035 tp->phy_reg_anlpar = rtl8168_mdio_read(tp, MII_LPA);
4036 tp->phy_reg_gbsr = rtl8168_mdio_read(tp, MII_STAT1000);
4037
4038 if (netif_msg_ifup(tp))
4039 printk(KERN_INFO PFX "%s: link up\n", dev->name);
4040 } else {
4041 if (netif_msg_ifdown(tp))
4042 printk(KERN_INFO PFX "%s: link down\n", dev->name);
4043
4044 tp->phy_reg_aner = 0;
4045 tp->phy_reg_anlpar = 0;
4046 tp->phy_reg_gbsr = 0;
4047
4048 netif_stop_queue(dev);
4049
4050 netif_carrier_off(dev);
4051
4052 rtl8168_hw_reset(dev);
4053
4054 rtl8168_tx_clear(tp);
4055
4056 rtl8168_rx_clear(tp);
4057
4058 rtl8168_init_ring(dev);
4059
4060 if (dynamic_aspm) {
4061 rtl8168_enable_cfg9346_write(tp);
4062 rtl8168_hw_aspm_clkreq_enable(tp, true);
4063 rtl8168_disable_cfg9346_write(tp);
4064 }
4065
4066 rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
4067
4068 switch (tp->mcfg) {
4069 case CFG_METHOD_21:
4070 case CFG_METHOD_22:
4071 case CFG_METHOD_23:
4072 case CFG_METHOD_24:
4073 case CFG_METHOD_25:
4074 case CFG_METHOD_27:
4075 case CFG_METHOD_28:
4076 if (tp->org_pci_offset_99 & BIT_2)
4077 tp->issue_offset_99_event = TRUE;
4078 break;
4079 }
4080
4081 #ifdef ENABLE_DASH_SUPPORT
4082 if (tp->DASH) {
4083 NICChkTypeEnableDashInterrupt(tp);
4084 }
4085 #endif
4086 }
4087 }
4088
4089 if (!link_status_on) {
4090 switch (tp->mcfg) {
4091 case CFG_METHOD_21:
4092 case CFG_METHOD_22:
4093 case CFG_METHOD_23:
4094 case CFG_METHOD_24:
4095 case CFG_METHOD_25:
4096 case CFG_METHOD_27:
4097 case CFG_METHOD_28:
4098 if (tp->issue_offset_99_event) {
4099 if (!(RTL_R8(tp, PHYstatus) & PowerSaveStatus)) {
4100 tp->issue_offset_99_event = FALSE;
4101 rtl8168_issue_offset_99_event(tp);
4102 }
4103 }
4104 break;
4105 }
4106 } else {
4107 if (dynamic_aspm) {
4108 bool enable_hw_aspm_clkreq = true;
4109 if (tp->dynamic_aspm_packet_count > dynamic_aspm_packet_threshold)
4110 enable_hw_aspm_clkreq = false;
4111
4112 rtl8168_enable_cfg9346_write(tp);
4113 rtl8168_hw_aspm_clkreq_enable(tp, enable_hw_aspm_clkreq);
4114 rtl8168_disable_cfg9346_write(tp);
4115 }
4116 tp->dynamic_aspm_packet_count = 0;
4117 }
4118 }
4119
4120 static void
rtl8168_link_option(u8 * aut,u32 * spd,u8 * dup,u32 * adv)4121 rtl8168_link_option(u8 *aut,
4122 u32 *spd,
4123 u8 *dup,
4124 u32 *adv)
4125 {
4126 if ((*spd != SPEED_1000) && (*spd != SPEED_100) && (*spd != SPEED_10))
4127 *spd = SPEED_1000;
4128
4129 if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF))
4130 *dup = DUPLEX_FULL;
4131
4132 if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE))
4133 *aut = AUTONEG_ENABLE;
4134
4135 *adv &= (ADVERTISED_10baseT_Half |
4136 ADVERTISED_10baseT_Full |
4137 ADVERTISED_100baseT_Half |
4138 ADVERTISED_100baseT_Full |
4139 ADVERTISED_1000baseT_Half |
4140 ADVERTISED_1000baseT_Full);
4141 if (*adv == 0)
4142 *adv = (ADVERTISED_10baseT_Half |
4143 ADVERTISED_10baseT_Full |
4144 ADVERTISED_100baseT_Half |
4145 ADVERTISED_100baseT_Full |
4146 ADVERTISED_1000baseT_Half |
4147 ADVERTISED_1000baseT_Full);
4148 }
4149
4150 static void
rtl8168_enable_ocp_phy_power_saving(struct net_device * dev)4151 rtl8168_enable_ocp_phy_power_saving(struct net_device *dev)
4152 {
4153 struct rtl8168_private *tp = netdev_priv(dev);
4154 u16 val;
4155
4156 if (tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
4157 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
4158 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
4159 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4160 tp->mcfg == CFG_METHOD_33) {
4161 val = rtl8168_mdio_read_phy_ocp(tp, 0x0C41, 0x13);
4162 if (val != 0x0050) {
4163 rtl8168_set_phy_mcu_patch_request(tp);
4164 rtl8168_mdio_write_phy_ocp(tp, 0x0C41, 0x13, 0x0000);
4165 rtl8168_mdio_write_phy_ocp(tp, 0x0C41, 0x13, 0x0050);
4166 rtl8168_clear_phy_mcu_patch_request(tp);
4167 }
4168 }
4169 }
4170
4171 static void
rtl8168_disable_ocp_phy_power_saving(struct net_device * dev)4172 rtl8168_disable_ocp_phy_power_saving(struct net_device *dev)
4173 {
4174 struct rtl8168_private *tp = netdev_priv(dev);
4175 u16 val;
4176
4177 if (tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
4178 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
4179 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
4180 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4181 tp->mcfg == CFG_METHOD_33) {
4182 val = rtl8168_mdio_read_phy_ocp(tp, 0x0C41, 0x13);
4183 if (val != 0x0500) {
4184 rtl8168_set_phy_mcu_patch_request(tp);
4185 rtl8168_mdio_write_phy_ocp(tp, 0x0C41, 0x13, 0x0000);
4186 rtl8168_mdio_write_phy_ocp(tp, 0x0C41, 0x13, 0x0500);
4187 rtl8168_clear_phy_mcu_patch_request(tp);
4188 }
4189 }
4190 }
4191
4192 void
rtl8168_wait_ll_share_fifo_ready(struct net_device * dev)4193 rtl8168_wait_ll_share_fifo_ready(struct net_device *dev)
4194 {
4195 struct rtl8168_private *tp = netdev_priv(dev);
4196 int i;
4197
4198 for (i = 0; i < 10; i++) {
4199 udelay(100);
4200 if (RTL_R16(tp, 0xD2) & BIT_9)
4201 break;
4202 }
4203 }
4204
4205 static void
rtl8168_disable_pci_offset_99(struct rtl8168_private * tp)4206 rtl8168_disable_pci_offset_99(struct rtl8168_private *tp)
4207 {
4208 u32 csi_tmp;
4209
4210 switch (tp->mcfg) {
4211 case CFG_METHOD_21:
4212 case CFG_METHOD_22:
4213 case CFG_METHOD_23:
4214 case CFG_METHOD_24:
4215 case CFG_METHOD_25:
4216 case CFG_METHOD_26:
4217 case CFG_METHOD_27:
4218 case CFG_METHOD_28:
4219 case CFG_METHOD_29:
4220 case CFG_METHOD_30:
4221 case CFG_METHOD_31:
4222 case CFG_METHOD_32:
4223 case CFG_METHOD_33:
4224 csi_tmp = rtl8168_eri_read(tp, 0x3F2, 2, ERIAR_ExGMAC);
4225 csi_tmp &= ~(BIT_0 | BIT_1);
4226 rtl8168_eri_write(tp, 0x3F2, 2, csi_tmp, ERIAR_ExGMAC);
4227 break;
4228 }
4229
4230 switch (tp->mcfg) {
4231 case CFG_METHOD_21:
4232 case CFG_METHOD_22:
4233 case CFG_METHOD_26:
4234 case CFG_METHOD_29:
4235 case CFG_METHOD_30:
4236 case CFG_METHOD_31:
4237 case CFG_METHOD_32:
4238 case CFG_METHOD_33:
4239 rtl8168_csi_fun0_write_byte(tp, 0x99, 0x00);
4240 break;
4241 }
4242 }
4243
4244 static void
rtl8168_enable_pci_offset_99(struct rtl8168_private * tp)4245 rtl8168_enable_pci_offset_99(struct rtl8168_private *tp)
4246 {
4247 u32 csi_tmp;
4248
4249 switch (tp->mcfg) {
4250 case CFG_METHOD_21:
4251 case CFG_METHOD_22:
4252 case CFG_METHOD_26:
4253 case CFG_METHOD_29:
4254 case CFG_METHOD_30:
4255 case CFG_METHOD_31:
4256 case CFG_METHOD_32:
4257 case CFG_METHOD_33:
4258 rtl8168_csi_fun0_write_byte(tp, 0x99, tp->org_pci_offset_99);
4259 break;
4260 }
4261
4262 switch (tp->mcfg) {
4263 case CFG_METHOD_21:
4264 case CFG_METHOD_22:
4265 case CFG_METHOD_23:
4266 case CFG_METHOD_24:
4267 case CFG_METHOD_25:
4268 case CFG_METHOD_26:
4269 case CFG_METHOD_27:
4270 case CFG_METHOD_28:
4271 case CFG_METHOD_29:
4272 case CFG_METHOD_30:
4273 case CFG_METHOD_31:
4274 case CFG_METHOD_32:
4275 case CFG_METHOD_33:
4276 csi_tmp = rtl8168_eri_read(tp, 0x3F2, 2, ERIAR_ExGMAC);
4277 csi_tmp &= ~(BIT_0 | BIT_1);
4278 if (tp->org_pci_offset_99 & (BIT_5 | BIT_6))
4279 csi_tmp |= BIT_1;
4280 if (tp->org_pci_offset_99 & BIT_2)
4281 csi_tmp |= BIT_0;
4282 rtl8168_eri_write(tp, 0x3F2, 2, csi_tmp, ERIAR_ExGMAC);
4283 break;
4284 }
4285 }
4286
4287 static void
rtl8168_init_pci_offset_99(struct rtl8168_private * tp)4288 rtl8168_init_pci_offset_99(struct rtl8168_private *tp)
4289 {
4290 u32 csi_tmp;
4291
4292 switch (tp->mcfg) {
4293 case CFG_METHOD_26:
4294 if (tp->org_pci_offset_99 & BIT_2) {
4295 csi_tmp = rtl8168_eri_read(tp, 0x5C2, 1, ERIAR_ExGMAC);
4296 csi_tmp &= ~BIT_1;
4297 rtl8168_eri_write(tp, 0x5C2, 1, csi_tmp, ERIAR_ExGMAC);
4298 }
4299 break;
4300 }
4301
4302 switch (tp->mcfg) {
4303 case CFG_METHOD_21:
4304 case CFG_METHOD_22:
4305 case CFG_METHOD_23:
4306 case CFG_METHOD_24:
4307 case CFG_METHOD_25:
4308 case CFG_METHOD_26:
4309 case CFG_METHOD_27:
4310 case CFG_METHOD_28:
4311 case CFG_METHOD_29:
4312 case CFG_METHOD_30:
4313 case CFG_METHOD_31:
4314 case CFG_METHOD_32:
4315 case CFG_METHOD_33:
4316 csi_tmp = rtl8168_eri_read(tp, 0x3F2, 2, ERIAR_ExGMAC);
4317 csi_tmp &= ~( BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12 | BIT_13 | BIT_14 | BIT_15 );
4318 csi_tmp |= ( BIT_9 | BIT_10 | BIT_13 | BIT_14 | BIT_15 );
4319 rtl8168_eri_write(tp, 0x3F2, 2, csi_tmp, ERIAR_ExGMAC);
4320 csi_tmp = rtl8168_eri_read(tp, 0x3F5, 1, ERIAR_ExGMAC);
4321 csi_tmp |= BIT_6 | BIT_7;
4322 rtl8168_eri_write(tp, 0x3F5, 1, csi_tmp, ERIAR_ExGMAC);
4323 rtl8168_mac_ocp_write(tp, 0xE02C, 0x1880);
4324 rtl8168_mac_ocp_write(tp, 0xE02E, 0x4880);
4325 break;
4326 }
4327
4328 switch (tp->mcfg) {
4329 case CFG_METHOD_26:
4330 rtl8168_eri_write(tp, 0x5C0, 1, 0xFA, ERIAR_ExGMAC);
4331 break;
4332 }
4333
4334 switch (tp->mcfg) {
4335 case CFG_METHOD_26:
4336 if (tp->org_pci_offset_99 & BIT_2) {
4337 csi_tmp = rtl8168_eri_read(tp, 0x5C8, 1, ERIAR_ExGMAC);
4338 csi_tmp |= BIT_0;
4339 rtl8168_eri_write(tp, 0x5C8, 1, csi_tmp, ERIAR_ExGMAC);
4340 }
4341 break;
4342 case CFG_METHOD_29:
4343 case CFG_METHOD_30:
4344 case CFG_METHOD_31:
4345 case CFG_METHOD_32:
4346 case CFG_METHOD_33:
4347 if (tp->org_pci_offset_99 & BIT_2)
4348 rtl8168_mac_ocp_write(tp, 0xE0A2, rtl8168_mac_ocp_read(tp, 0xE0A2) | BIT_0);
4349 break;
4350 }
4351
4352 switch (tp->mcfg) {
4353 case CFG_METHOD_23:
4354 rtl8168_eri_write(tp, 0x2E8, 2, 0x883C, ERIAR_ExGMAC);
4355 rtl8168_eri_write(tp, 0x2EA, 2, 0x8C12, ERIAR_ExGMAC);
4356 rtl8168_eri_write(tp, 0x2EC, 2, 0x9003, ERIAR_ExGMAC);
4357 rtl8168_eri_write(tp, 0x2E2, 2, 0x883C, ERIAR_ExGMAC);
4358 rtl8168_eri_write(tp, 0x2E4, 2, 0x8C12, ERIAR_ExGMAC);
4359 rtl8168_eri_write(tp, 0x2E6, 2, 0x9003, ERIAR_ExGMAC);
4360 break;
4361 case CFG_METHOD_21:
4362 case CFG_METHOD_22:
4363 case CFG_METHOD_24:
4364 case CFG_METHOD_25:
4365 case CFG_METHOD_26:
4366 case CFG_METHOD_27:
4367 case CFG_METHOD_28:
4368 case CFG_METHOD_29:
4369 case CFG_METHOD_30:
4370 case CFG_METHOD_31:
4371 case CFG_METHOD_32:
4372 case CFG_METHOD_33:
4373 rtl8168_eri_write(tp, 0x2E8, 2, 0x9003, ERIAR_ExGMAC);
4374 rtl8168_eri_write(tp, 0x2EA, 2, 0x9003, ERIAR_ExGMAC);
4375 rtl8168_eri_write(tp, 0x2EC, 2, 0x9003, ERIAR_ExGMAC);
4376 rtl8168_eri_write(tp, 0x2E2, 2, 0x883C, ERIAR_ExGMAC);
4377 rtl8168_eri_write(tp, 0x2E4, 2, 0x8C12, ERIAR_ExGMAC);
4378 rtl8168_eri_write(tp, 0x2E6, 2, 0x9003, ERIAR_ExGMAC);
4379 break;
4380 }
4381
4382 switch (tp->mcfg) {
4383 case CFG_METHOD_21:
4384 case CFG_METHOD_22:
4385 case CFG_METHOD_24:
4386 case CFG_METHOD_25:
4387 case CFG_METHOD_26:
4388 case CFG_METHOD_27:
4389 case CFG_METHOD_28:
4390 csi_tmp = rtl8168_eri_read(tp, 0x3FA, 2, ERIAR_ExGMAC);
4391 csi_tmp |= BIT_14;
4392 rtl8168_eri_write(tp, 0x3FA, 2, csi_tmp, ERIAR_ExGMAC);
4393 break;
4394 }
4395
4396 switch (tp->mcfg) {
4397 case CFG_METHOD_26:
4398 case CFG_METHOD_29:
4399 case CFG_METHOD_30:
4400 if (tp->org_pci_offset_99 & BIT_2)
4401 RTL_W8(tp, 0xB6, RTL_R8(tp, 0xB6) | BIT_0);
4402 break;
4403 }
4404
4405 rtl8168_enable_pci_offset_99(tp);
4406 }
4407
4408 static void
rtl8168_disable_pci_offset_180(struct rtl8168_private * tp)4409 rtl8168_disable_pci_offset_180(struct rtl8168_private *tp)
4410 {
4411 u32 csi_tmp;
4412
4413 switch (tp->mcfg) {
4414 case CFG_METHOD_24:
4415 case CFG_METHOD_25:
4416 case CFG_METHOD_26:
4417 case CFG_METHOD_27:
4418 case CFG_METHOD_28:
4419 case CFG_METHOD_29:
4420 case CFG_METHOD_30:
4421 case CFG_METHOD_31:
4422 case CFG_METHOD_32:
4423 case CFG_METHOD_33:
4424 csi_tmp = rtl8168_eri_read(tp, 0x1E2, 1, ERIAR_ExGMAC);
4425 csi_tmp &= ~BIT_2;
4426 rtl8168_eri_write(tp, 0x1E2, 1, csi_tmp, ERIAR_ExGMAC);
4427 break;
4428 }
4429
4430 switch (tp->mcfg) {
4431 case CFG_METHOD_26:
4432 rtl8168_eri_write(tp, 0x1E9, 1, 0x0A, ERIAR_ExGMAC);
4433 break;
4434 }
4435 }
4436
4437 static void
rtl8168_enable_pci_offset_180(struct rtl8168_private * tp)4438 rtl8168_enable_pci_offset_180(struct rtl8168_private *tp)
4439 {
4440 u32 csi_tmp;
4441
4442 switch (tp->mcfg) {
4443 case CFG_METHOD_25:
4444 case CFG_METHOD_28:
4445 csi_tmp = rtl8168_eri_read(tp, 0x1E8, 4, ERIAR_ExGMAC);
4446 csi_tmp &= ~(0x0000FF00);
4447 csi_tmp |= (0x00006400);
4448 rtl8168_eri_write(tp, 0x1E8, 4, csi_tmp, ERIAR_ExGMAC);
4449
4450 csi_tmp = rtl8168_eri_read(tp, 0x1E4, 4, ERIAR_ExGMAC);
4451 csi_tmp &= ~(0x0000FF00);
4452 rtl8168_eri_write(tp, 0x1E4, 4, csi_tmp, ERIAR_ExGMAC);
4453 break;
4454 case CFG_METHOD_31:
4455 case CFG_METHOD_32:
4456 case CFG_METHOD_33:
4457 csi_tmp = rtl8168_eri_read(tp, 0x1E8, 4, ERIAR_ExGMAC);
4458 csi_tmp &= ~(0x0000FFF0);
4459 csi_tmp |= (0x00000640);
4460 rtl8168_eri_write(tp, 0x1E8, 4, csi_tmp, ERIAR_ExGMAC);
4461
4462 csi_tmp = rtl8168_eri_read(tp, 0x1E4, 4, ERIAR_ExGMAC);
4463 csi_tmp &= ~(0x0000FF00);
4464 rtl8168_eri_write(tp, 0x1E4, 4, csi_tmp, ERIAR_ExGMAC);
4465 break;
4466 }
4467
4468 switch (tp->mcfg) {
4469 case CFG_METHOD_24:
4470 case CFG_METHOD_25:
4471 case CFG_METHOD_26:
4472 case CFG_METHOD_27:
4473 case CFG_METHOD_28:
4474 case CFG_METHOD_29:
4475 case CFG_METHOD_30:
4476 csi_tmp = rtl8168_eri_read(tp, 0x1E2, 1, ERIAR_ExGMAC);
4477 csi_tmp |= BIT_2;
4478 rtl8168_eri_write(tp, 0x1E2, 1, csi_tmp, ERIAR_ExGMAC);
4479 break;
4480 }
4481
4482 switch (tp->mcfg) {
4483 case CFG_METHOD_26:
4484 rtl8168_eri_write(tp, 0x1E9, 1, 0x64, ERIAR_ExGMAC);
4485 break;
4486 }
4487
4488 rtl8168_mac_ocp_write(tp, 0xE094, 0x0000);
4489 }
4490
4491 static void
rtl8168_init_pci_offset_180(struct rtl8168_private * tp)4492 rtl8168_init_pci_offset_180(struct rtl8168_private *tp)
4493 {
4494 if (tp->org_pci_offset_180 & (BIT_0|BIT_1))
4495 rtl8168_enable_pci_offset_180(tp);
4496 else
4497 rtl8168_disable_pci_offset_180(tp);
4498 }
4499
4500 static void
rtl8168_set_pci_99_180_exit_driver_para(struct net_device * dev)4501 rtl8168_set_pci_99_180_exit_driver_para(struct net_device *dev)
4502 {
4503 struct rtl8168_private *tp = netdev_priv(dev);
4504
4505 switch (tp->mcfg) {
4506 case CFG_METHOD_21:
4507 case CFG_METHOD_22:
4508 case CFG_METHOD_23:
4509 case CFG_METHOD_24:
4510 case CFG_METHOD_25:
4511 case CFG_METHOD_27:
4512 case CFG_METHOD_28:
4513 case CFG_METHOD_29:
4514 case CFG_METHOD_30:
4515 case CFG_METHOD_31:
4516 case CFG_METHOD_32:
4517 case CFG_METHOD_33:
4518 rtl8168_issue_offset_99_event(tp);
4519 break;
4520 }
4521
4522 switch (tp->mcfg) {
4523 case CFG_METHOD_21:
4524 case CFG_METHOD_22:
4525 case CFG_METHOD_23:
4526 case CFG_METHOD_24:
4527 case CFG_METHOD_25:
4528 case CFG_METHOD_26:
4529 case CFG_METHOD_27:
4530 case CFG_METHOD_28:
4531 case CFG_METHOD_29:
4532 case CFG_METHOD_30:
4533 case CFG_METHOD_31:
4534 case CFG_METHOD_32:
4535 case CFG_METHOD_33:
4536 rtl8168_disable_pci_offset_99(tp);
4537 break;
4538 }
4539 switch (tp->mcfg) {
4540 case CFG_METHOD_24:
4541 case CFG_METHOD_25:
4542 case CFG_METHOD_26:
4543 case CFG_METHOD_27:
4544 case CFG_METHOD_28:
4545 case CFG_METHOD_29:
4546 case CFG_METHOD_30:
4547 case CFG_METHOD_31:
4548 case CFG_METHOD_32:
4549 case CFG_METHOD_33:
4550 rtl8168_disable_pci_offset_180(tp);
4551 break;
4552 }
4553 }
4554
4555 static void
rtl8168_hw_d3_para(struct net_device * dev)4556 rtl8168_hw_d3_para(struct net_device *dev)
4557 {
4558 struct rtl8168_private *tp = netdev_priv(dev);
4559
4560 RTL_W16(tp, RxMaxSize, RX_BUF_SIZE);
4561
4562 if (tp->HwSuppAspmClkIntrLock) {
4563 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7);
4564 rtl8168_enable_cfg9346_write(tp);
4565 rtl8168_hw_aspm_clkreq_enable(tp, false);
4566 rtl8168_disable_cfg9346_write(tp);
4567 }
4568
4569 rtl8168_disable_exit_l1_mask(tp);
4570
4571 #ifdef ENABLE_REALWOW_SUPPORT
4572 rtl8168_set_realwow_d3_para(dev);
4573 #endif
4574
4575 if (tp->mcfg == CFG_METHOD_18 || tp->mcfg == CFG_METHOD_19 || tp->mcfg == CFG_METHOD_20) {
4576 rtl8168_eri_write(tp, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC);
4577 rtl8168_eri_write(tp, 0x1dc, 4, 0x0000002d, ERIAR_ExGMAC);
4578 } else if (tp->mcfg == CFG_METHOD_16) {
4579 rtl8168_eri_write(tp, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC);
4580 rtl8168_eri_write(tp, 0x1dc, 4, 0x0000003f, ERIAR_ExGMAC);
4581 }
4582
4583 if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
4584 tp->mcfg == CFG_METHOD_23 || tp->mcfg == CFG_METHOD_24 ||
4585 tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
4586 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
4587 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4588 tp->mcfg == CFG_METHOD_33) {
4589 rtl8168_eri_write(tp, 0x2F8, 2, 0x0064, ERIAR_ExGMAC);
4590 }
4591
4592 if (tp->bios_setting & BIT_28) {
4593 if (tp->mcfg == CFG_METHOD_18 || tp->mcfg == CFG_METHOD_19 ||
4594 tp->mcfg == CFG_METHOD_20) {
4595 u32 gphy_val;
4596
4597 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4598 rtl8168_mdio_write(tp, 0x04, 0x0061);
4599 rtl8168_mdio_write(tp, 0x09, 0x0000);
4600 rtl8168_mdio_write(tp, 0x00, 0x9200);
4601 rtl8168_mdio_write(tp, 0x1F, 0x0005);
4602 rtl8168_mdio_write(tp, 0x05, 0x8B80);
4603 gphy_val = rtl8168_mdio_read(tp, 0x06);
4604 gphy_val &= ~BIT_7;
4605 rtl8168_mdio_write(tp, 0x06, gphy_val);
4606 mdelay(1);
4607 rtl8168_mdio_write(tp, 0x1F, 0x0007);
4608 rtl8168_mdio_write(tp, 0x1E, 0x002C);
4609 gphy_val = rtl8168_mdio_read(tp, 0x16);
4610 gphy_val &= ~BIT_10;
4611 rtl8168_mdio_write(tp, 0x16, gphy_val);
4612 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4613 }
4614 }
4615
4616 rtl8168_set_pci_99_180_exit_driver_para(dev);
4617
4618 /*disable ocp phy power saving*/
4619 if (tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
4620 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
4621 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
4622 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4623 tp->mcfg == CFG_METHOD_33)
4624 if (!tp->dash_printer_enabled)
4625 rtl8168_disable_ocp_phy_power_saving(dev);
4626
4627 rtl8168_disable_rxdvgate(dev);
4628 }
4629
4630 static void
rtl8168_enable_magic_packet(struct net_device * dev)4631 rtl8168_enable_magic_packet(struct net_device *dev)
4632 {
4633 struct rtl8168_private *tp = netdev_priv(dev);
4634 u32 csi_tmp;
4635
4636 switch (tp->HwSuppMagicPktVer) {
4637 case WAKEUP_MAGIC_PACKET_V1:
4638 rtl8168_enable_cfg9346_write(tp);
4639 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | MagicPacket);
4640 rtl8168_disable_cfg9346_write(tp);
4641 break;
4642 case WAKEUP_MAGIC_PACKET_V2:
4643 csi_tmp = rtl8168_eri_read(tp, 0xDE, 1, ERIAR_ExGMAC);
4644 csi_tmp |= BIT_0;
4645 rtl8168_eri_write(tp, 0xDE, 1, csi_tmp, ERIAR_ExGMAC);
4646 break;
4647 }
4648 }
4649 static void
rtl8168_disable_magic_packet(struct net_device * dev)4650 rtl8168_disable_magic_packet(struct net_device *dev)
4651 {
4652 struct rtl8168_private *tp = netdev_priv(dev);
4653 u32 csi_tmp;
4654
4655 switch (tp->HwSuppMagicPktVer) {
4656 case WAKEUP_MAGIC_PACKET_V1:
4657 rtl8168_enable_cfg9346_write(tp);
4658 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~MagicPacket);
4659 rtl8168_disable_cfg9346_write(tp);
4660 break;
4661 case WAKEUP_MAGIC_PACKET_V2:
4662 csi_tmp = rtl8168_eri_read(tp, 0xDE, 1, ERIAR_ExGMAC);
4663 csi_tmp &= ~BIT_0;
4664 rtl8168_eri_write(tp, 0xDE, 1, csi_tmp, ERIAR_ExGMAC);
4665 break;
4666 }
4667 }
4668
4669 #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)
4670
4671 static void
rtl8168_get_hw_wol(struct net_device * dev)4672 rtl8168_get_hw_wol(struct net_device *dev)
4673 {
4674 struct rtl8168_private *tp = netdev_priv(dev);
4675 u8 options;
4676 u32 csi_tmp;
4677 unsigned long flags;
4678
4679
4680 spin_lock_irqsave(&tp->lock, flags);
4681
4682 tp->wol_opts = 0;
4683 options = RTL_R8(tp, Config1);
4684 if (!(options & PMEnable))
4685 goto out_unlock;
4686
4687 options = RTL_R8(tp, Config3);
4688 if (options & LinkUp)
4689 tp->wol_opts |= WAKE_PHY;
4690
4691 switch (tp->HwSuppMagicPktVer) {
4692 case WAKEUP_MAGIC_PACKET_V2:
4693 csi_tmp = rtl8168_eri_read(tp, 0xDE, 1, ERIAR_ExGMAC);
4694 if (csi_tmp & BIT_0)
4695 tp->wol_opts |= WAKE_MAGIC;
4696 break;
4697 default:
4698 if (options & MagicPacket)
4699 tp->wol_opts |= WAKE_MAGIC;
4700 break;
4701 }
4702
4703 options = RTL_R8(tp, Config5);
4704 if (options & UWF)
4705 tp->wol_opts |= WAKE_UCAST;
4706 if (options & BWF)
4707 tp->wol_opts |= WAKE_BCAST;
4708 if (options & MWF)
4709 tp->wol_opts |= WAKE_MCAST;
4710
4711 out_unlock:
4712 tp->wol_enabled = (tp->wol_opts || tp->dash_printer_enabled) ? WOL_ENABLED : WOL_DISABLED;
4713
4714 spin_unlock_irqrestore(&tp->lock, flags);
4715 }
4716
4717 static void
rtl8168_set_hw_wol(struct net_device * dev,u32 wolopts)4718 rtl8168_set_hw_wol(struct net_device *dev, u32 wolopts)
4719 {
4720 struct rtl8168_private *tp = netdev_priv(dev);
4721 int i,tmp;
4722 static struct {
4723 u32 opt;
4724 u16 reg;
4725 u8 mask;
4726 } cfg[] = {
4727 { WAKE_PHY, Config3, LinkUp },
4728 { WAKE_UCAST, Config5, UWF },
4729 { WAKE_BCAST, Config5, BWF },
4730 { WAKE_MCAST, Config5, MWF },
4731 { WAKE_ANY, Config5, LanWake },
4732 { WAKE_MAGIC, Config3, MagicPacket },
4733 };
4734
4735 switch (tp->HwSuppMagicPktVer) {
4736 case WAKEUP_MAGIC_PACKET_V2:
4737 tmp = ARRAY_SIZE(cfg) - 1;
4738
4739 if (wolopts & WAKE_MAGIC)
4740 rtl8168_enable_magic_packet(dev);
4741 else
4742 rtl8168_disable_magic_packet(dev);
4743 break;
4744 default:
4745 tmp = ARRAY_SIZE(cfg);
4746 break;
4747 }
4748
4749 rtl8168_enable_cfg9346_write(tp);
4750
4751 for (i = 0; i < tmp; i++) {
4752 u8 options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask;
4753 if (wolopts & cfg[i].opt)
4754 options |= cfg[i].mask;
4755 RTL_W8(tp, cfg[i].reg, options);
4756 }
4757
4758 if (tp->dash_printer_enabled)
4759 RTL_W8(tp, Config5, RTL_R8(tp, Config5) | LanWake);
4760
4761 rtl8168_disable_cfg9346_write(tp);
4762 }
4763
4764 static void
rtl8168_phy_restart_nway(struct net_device * dev)4765 rtl8168_phy_restart_nway(struct net_device *dev)
4766 {
4767 struct rtl8168_private *tp = netdev_priv(dev);
4768
4769 if (rtl8168_is_in_phy_disable_mode(dev)) return;
4770
4771 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4772 rtl8168_mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE | BMCR_ANRESTART);
4773 }
4774
4775 static void
rtl8168_phy_setup_force_mode(struct net_device * dev,u32 speed,u8 duplex)4776 rtl8168_phy_setup_force_mode(struct net_device *dev, u32 speed, u8 duplex)
4777 {
4778 struct rtl8168_private *tp = netdev_priv(dev);
4779 u16 bmcr_true_force = 0;
4780
4781 if (rtl8168_is_in_phy_disable_mode(dev)) return;
4782
4783 if ((speed == SPEED_10) && (duplex == DUPLEX_HALF)) {
4784 bmcr_true_force = BMCR_SPEED10;
4785 } else if ((speed == SPEED_10) && (duplex == DUPLEX_FULL)) {
4786 bmcr_true_force = BMCR_SPEED10 | BMCR_FULLDPLX;
4787 } else if ((speed == SPEED_100) && (duplex == DUPLEX_HALF)) {
4788 bmcr_true_force = BMCR_SPEED100;
4789 } else if ((speed == SPEED_100) && (duplex == DUPLEX_FULL)) {
4790 bmcr_true_force = BMCR_SPEED100 | BMCR_FULLDPLX;
4791 } else {
4792 netif_err(tp, drv, dev, "Failed to set phy force mode!\n");
4793 return;
4794 }
4795
4796 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4797 rtl8168_mdio_write(tp, MII_BMCR, bmcr_true_force);
4798 }
4799
4800 static void
rtl8168_set_pci_pme(struct rtl8168_private * tp,int set)4801 rtl8168_set_pci_pme(struct rtl8168_private *tp, int set)
4802 {
4803 struct pci_dev *pdev = tp->pci_dev;
4804 u16 pmc;
4805
4806 if (!pdev->pm_cap)
4807 return;
4808
4809 pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &pmc);
4810 pmc |= PCI_PM_CTRL_PME_STATUS;
4811 if (set)
4812 pmc |= PCI_PM_CTRL_PME_ENABLE;
4813 else
4814 pmc &= ~PCI_PM_CTRL_PME_ENABLE;
4815 pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc);
4816 }
4817
4818 static void
rtl8168_set_wol_link_speed(struct net_device * dev)4819 rtl8168_set_wol_link_speed(struct net_device *dev)
4820 {
4821 struct rtl8168_private *tp = netdev_priv(dev);
4822 int auto_nego;
4823 int giga_ctrl;
4824 u32 adv;
4825 u16 anlpar;
4826 u16 gbsr;
4827 u16 aner;
4828
4829 if (tp->autoneg != AUTONEG_ENABLE)
4830 goto exit;
4831
4832 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4833
4834 auto_nego = rtl8168_mdio_read(tp, MII_ADVERTISE);
4835 auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL
4836 | ADVERTISE_100HALF | ADVERTISE_100FULL);
4837
4838 giga_ctrl = rtl8168_mdio_read(tp, MII_CTRL1000);
4839 giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL);
4840
4841 aner = anlpar = gbsr = 0;
4842 if (tp->link_ok(dev)) {
4843 aner = rtl8168_mdio_read(tp, MII_EXPANSION);
4844 anlpar = rtl8168_mdio_read(tp, MII_LPA);
4845 gbsr = rtl8168_mdio_read(tp, MII_STAT1000);
4846 } else {
4847 if (netif_running(dev)) {
4848 aner = tp->phy_reg_aner;
4849 anlpar = tp->phy_reg_anlpar;
4850 gbsr = tp->phy_reg_gbsr;
4851 }
4852 }
4853
4854 if ((aner | anlpar | gbsr) == 0) {
4855 int auto_nego_tmp = 0;
4856 adv = tp->advertising;
4857 if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF))
4858 auto_nego_tmp |= ADVERTISE_10HALF;
4859 if ((adv & ADVERTISED_10baseT_Full) && (anlpar & LPA_10FULL))
4860 auto_nego_tmp |= ADVERTISE_10FULL;
4861 if ((adv & ADVERTISED_100baseT_Half) && (anlpar & LPA_100HALF))
4862 auto_nego_tmp |= ADVERTISE_100HALF;
4863 if ((adv & ADVERTISED_100baseT_Full) && (anlpar & LPA_100FULL))
4864 auto_nego_tmp |= ADVERTISE_100FULL;
4865
4866 if (auto_nego_tmp == 0) goto exit;
4867
4868 auto_nego |= auto_nego_tmp;
4869 goto skip_check_lpa;
4870 }
4871 if (!(aner & EXPANSION_NWAY)) goto exit;
4872
4873 adv = tp->advertising;
4874 if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF))
4875 auto_nego |= ADVERTISE_10HALF;
4876 else if ((adv & ADVERTISED_10baseT_Full) && (anlpar & LPA_10FULL))
4877 auto_nego |= ADVERTISE_10FULL;
4878 else if ((adv & ADVERTISED_100baseT_Half) && (anlpar & LPA_100HALF))
4879 auto_nego |= ADVERTISE_100HALF;
4880 else if ((adv & ADVERTISED_100baseT_Full) && (anlpar & LPA_100FULL))
4881 auto_nego |= ADVERTISE_100FULL;
4882 else if (adv & ADVERTISED_1000baseT_Half && (gbsr & LPA_1000HALF))
4883 giga_ctrl |= ADVERTISE_1000HALF;
4884 else if (adv & ADVERTISED_1000baseT_Full && (gbsr & LPA_1000FULL))
4885 giga_ctrl |= ADVERTISE_1000FULL;
4886 else
4887 goto exit;
4888
4889 skip_check_lpa:
4890 if (tp->DASH)
4891 auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL);
4892
4893 if (((tp->mcfg == CFG_METHOD_7) || (tp->mcfg == CFG_METHOD_8)) && (RTL_R16(tp, CPlusCmd) & ASF))
4894 auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL);
4895
4896 #ifdef CONFIG_DOWN_SPEED_100
4897 auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL);
4898 #endif
4899
4900 rtl8168_mdio_write(tp, MII_ADVERTISE, auto_nego);
4901 rtl8168_mdio_write(tp, MII_CTRL1000, giga_ctrl);
4902
4903 rtl8168_phy_restart_nway(dev);
4904
4905 exit:
4906 return;
4907 }
4908
4909 static void
rtl8168_powerdown_pll(struct net_device * dev)4910 rtl8168_powerdown_pll(struct net_device *dev)
4911 {
4912 struct rtl8168_private *tp = netdev_priv(dev);
4913
4914 #ifdef ENABLE_FIBER_SUPPORT
4915 if (HW_FIBER_MODE_ENABLED(tp))
4916 return;
4917 #endif //ENABLE_FIBER_SUPPORT
4918
4919 if (tp->wol_enabled == WOL_ENABLED || tp->DASH || tp->EnableKCPOffload) {
4920 rtl8168_set_hw_wol(dev, tp->wol_opts);
4921
4922 if (tp->mcfg == CFG_METHOD_16 || tp->mcfg == CFG_METHOD_17 ||
4923 tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
4924 tp->mcfg == CFG_METHOD_24 || tp->mcfg == CFG_METHOD_25 ||
4925 tp->mcfg == CFG_METHOD_26 || tp->mcfg == CFG_METHOD_23 ||
4926 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
4927 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
4928 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
4929 tp->mcfg == CFG_METHOD_33) {
4930 rtl8168_enable_cfg9346_write(tp);
4931 RTL_W8(tp, Config2, RTL_R8(tp, Config2) | PMSTS_En);
4932 rtl8168_disable_cfg9346_write(tp);
4933 }
4934
4935 /* Enable the PME and clear the status */
4936 rtl8168_set_pci_pme(tp, 1);
4937
4938 if (HW_SUPP_SERDES_PHY(tp))
4939 return;
4940
4941 rtl8168_set_wol_link_speed(dev);
4942
4943 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
4944
4945 return;
4946 }
4947
4948 if (tp->DASH)
4949 return;
4950
4951 if (((tp->mcfg == CFG_METHOD_7) || (tp->mcfg == CFG_METHOD_8)) && (RTL_R16(tp, CPlusCmd) & ASF))
4952 return;
4953
4954 rtl8168_phy_power_down(dev);
4955
4956 if (!tp->HwIcVerUnknown) {
4957 switch (tp->mcfg) {
4958 case CFG_METHOD_9:
4959 case CFG_METHOD_10:
4960 //case CFG_METHOD_11:
4961 case CFG_METHOD_12:
4962 case CFG_METHOD_13:
4963 case CFG_METHOD_14:
4964 case CFG_METHOD_15:
4965 case CFG_METHOD_17:
4966 case CFG_METHOD_18:
4967 case CFG_METHOD_19:
4968 case CFG_METHOD_21:
4969 case CFG_METHOD_22:
4970 case CFG_METHOD_24:
4971 case CFG_METHOD_25:
4972 case CFG_METHOD_26:
4973 case CFG_METHOD_27:
4974 case CFG_METHOD_28:
4975 case CFG_METHOD_29:
4976 case CFG_METHOD_30:
4977 case CFG_METHOD_31:
4978 case CFG_METHOD_32:
4979 case CFG_METHOD_33:
4980 RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~BIT_7);
4981 break;
4982 }
4983 }
4984
4985 switch (tp->mcfg) {
4986 case CFG_METHOD_14 ... CFG_METHOD_15:
4987 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_6);
4988 break;
4989 case CFG_METHOD_16 ... CFG_METHOD_33:
4990 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_6);
4991 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_6);
4992 break;
4993 }
4994 }
4995
rtl8168_powerup_pll(struct net_device * dev)4996 static void rtl8168_powerup_pll(struct net_device *dev)
4997 {
4998 struct rtl8168_private *tp = netdev_priv(dev);
4999
5000 switch (tp->mcfg) {
5001 case CFG_METHOD_9:
5002 case CFG_METHOD_10:
5003 case CFG_METHOD_11:
5004 case CFG_METHOD_12:
5005 case CFG_METHOD_13:
5006 case CFG_METHOD_14:
5007 case CFG_METHOD_15:
5008 case CFG_METHOD_17:
5009 case CFG_METHOD_18:
5010 case CFG_METHOD_19:
5011 case CFG_METHOD_21:
5012 case CFG_METHOD_22:
5013 case CFG_METHOD_24:
5014 case CFG_METHOD_25:
5015 case CFG_METHOD_26:
5016 case CFG_METHOD_27:
5017 case CFG_METHOD_28:
5018 case CFG_METHOD_29:
5019 case CFG_METHOD_30:
5020 case CFG_METHOD_31:
5021 case CFG_METHOD_32:
5022 case CFG_METHOD_33:
5023 RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | BIT_7 | BIT_6);
5024 break;
5025 }
5026
5027 rtl8168_phy_power_up(dev);
5028 }
5029
5030 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5031 static void
rtl8168_get_wol(struct net_device * dev,struct ethtool_wolinfo * wol)5032 rtl8168_get_wol(struct net_device *dev,
5033 struct ethtool_wolinfo *wol)
5034 {
5035 struct rtl8168_private *tp = netdev_priv(dev);
5036 u8 options;
5037 unsigned long flags;
5038
5039 wol->wolopts = 0;
5040
5041 if (tp->mcfg == CFG_METHOD_DEFAULT) {
5042 wol->supported = 0;
5043 return;
5044 } else {
5045 wol->supported = WAKE_ANY;
5046 }
5047
5048 spin_lock_irqsave(&tp->lock, flags);
5049
5050 options = RTL_R8(tp, Config1);
5051 if (!(options & PMEnable))
5052 goto out_unlock;
5053
5054 wol->wolopts = tp->wol_opts;
5055
5056 out_unlock:
5057 spin_unlock_irqrestore(&tp->lock, flags);
5058 }
5059
5060 static int
rtl8168_set_wol(struct net_device * dev,struct ethtool_wolinfo * wol)5061 rtl8168_set_wol(struct net_device *dev,
5062 struct ethtool_wolinfo *wol)
5063 {
5064 struct rtl8168_private *tp = netdev_priv(dev);
5065 unsigned long flags;
5066
5067 if (tp->mcfg == CFG_METHOD_DEFAULT)
5068 return -EOPNOTSUPP;
5069
5070 spin_lock_irqsave(&tp->lock, flags);
5071
5072 tp->wol_opts = wol->wolopts;
5073
5074 tp->wol_enabled = (tp->wol_opts || tp->dash_printer_enabled) ? WOL_ENABLED : WOL_DISABLED;
5075
5076 spin_unlock_irqrestore(&tp->lock, flags);
5077
5078 device_set_wakeup_enable(tp_to_dev(tp), tp->wol_enabled);
5079
5080 return 0;
5081 }
5082
5083 static void
rtl8168_get_drvinfo(struct net_device * dev,struct ethtool_drvinfo * info)5084 rtl8168_get_drvinfo(struct net_device *dev,
5085 struct ethtool_drvinfo *info)
5086 {
5087 struct rtl8168_private *tp = netdev_priv(dev);
5088 struct rtl8168_fw *rtl_fw = tp->rtl_fw;
5089
5090 strcpy(info->driver, MODULENAME);
5091 strcpy(info->version, RTL8168_VERSION);
5092 strscpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info));
5093 info->regdump_len = R8168_REGS_DUMP_SIZE;
5094 info->eedump_len = tp->eeprom_len;
5095 BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version));
5096 if (rtl_fw)
5097 strlcpy(info->fw_version, rtl_fw->version,
5098 sizeof(info->fw_version));
5099 }
5100
5101 static int
rtl8168_get_regs_len(struct net_device * dev)5102 rtl8168_get_regs_len(struct net_device *dev)
5103 {
5104 return R8168_REGS_DUMP_SIZE;
5105 }
5106 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5107
5108 static int
rtl8168_set_speed_xmii(struct net_device * dev,u8 autoneg,u32 speed,u8 duplex,u32 adv)5109 rtl8168_set_speed_xmii(struct net_device *dev,
5110 u8 autoneg,
5111 u32 speed,
5112 u8 duplex,
5113 u32 adv)
5114 {
5115 struct rtl8168_private *tp = netdev_priv(dev);
5116 int auto_nego = 0;
5117 int giga_ctrl = 0;
5118 int rc = -EINVAL;
5119
5120 if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
5121 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
5122 tp->mcfg == CFG_METHOD_33) {
5123 //Disable Giga Lite
5124 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
5125 rtl8168_clear_eth_phy_bit(tp, 0x14, BIT_9);
5126 if (tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
5127 tp->mcfg == CFG_METHOD_33)
5128 rtl8168_clear_eth_phy_bit(tp, 0x14, BIT_7);
5129 rtl8168_mdio_write(tp, 0x1F, 0x0A40);
5130 rtl8168_mdio_write(tp, 0x1F, 0x0000);
5131 }
5132
5133 if ((speed != SPEED_1000) &&
5134 (speed != SPEED_100) &&
5135 (speed != SPEED_10)) {
5136 speed = SPEED_1000;
5137 duplex = DUPLEX_FULL;
5138 }
5139
5140 giga_ctrl = rtl8168_mdio_read(tp, MII_CTRL1000);
5141 giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL);
5142
5143 if (autoneg == AUTONEG_ENABLE) {
5144 /*n-way force*/
5145 auto_nego = rtl8168_mdio_read(tp, MII_ADVERTISE);
5146 auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
5147 ADVERTISE_100HALF | ADVERTISE_100FULL |
5148 ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
5149
5150 if (adv & ADVERTISED_10baseT_Half)
5151 auto_nego |= ADVERTISE_10HALF;
5152 if (adv & ADVERTISED_10baseT_Full)
5153 auto_nego |= ADVERTISE_10FULL;
5154 if (adv & ADVERTISED_100baseT_Half)
5155 auto_nego |= ADVERTISE_100HALF;
5156 if (adv & ADVERTISED_100baseT_Full)
5157 auto_nego |= ADVERTISE_100FULL;
5158 if (adv & ADVERTISED_1000baseT_Half)
5159 giga_ctrl |= ADVERTISE_1000HALF;
5160 if (adv & ADVERTISED_1000baseT_Full)
5161 giga_ctrl |= ADVERTISE_1000FULL;
5162
5163 //flow control
5164 if (dev->mtu <= ETH_DATA_LEN)
5165 auto_nego |= ADVERTISE_PAUSE_CAP|ADVERTISE_PAUSE_ASYM;
5166
5167 tp->phy_auto_nego_reg = auto_nego;
5168 tp->phy_1000_ctrl_reg = giga_ctrl;
5169
5170 rtl8168_mdio_write(tp, 0x1f, 0x0000);
5171 rtl8168_mdio_write(tp, MII_ADVERTISE, auto_nego);
5172 rtl8168_mdio_write(tp, MII_CTRL1000, giga_ctrl);
5173 rtl8168_phy_restart_nway(dev);
5174 mdelay(20);
5175 } else {
5176 /*true force*/
5177 if (speed == SPEED_10 || speed == SPEED_100)
5178 rtl8168_phy_setup_force_mode(dev, speed, duplex);
5179 else
5180 goto out;
5181 }
5182
5183 tp->autoneg = autoneg;
5184 tp->speed = speed;
5185 tp->duplex = duplex;
5186 tp->advertising = adv;
5187
5188 if (tp->mcfg == CFG_METHOD_11)
5189 rtl8168dp_10mbps_gphy_para(dev);
5190
5191 rc = 0;
5192 out:
5193 return rc;
5194 }
5195
5196 static int
rtl8168_set_speed(struct net_device * dev,u8 autoneg,u32 speed,u8 duplex,u32 adv)5197 rtl8168_set_speed(struct net_device *dev,
5198 u8 autoneg,
5199 u32 speed,
5200 u8 duplex,
5201 u32 adv)
5202 {
5203 struct rtl8168_private *tp = netdev_priv(dev);
5204 int ret;
5205
5206 ret = tp->set_speed(dev, autoneg, speed, duplex, adv);
5207
5208 return ret;
5209 }
5210
5211 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5212 static int
rtl8168_set_settings(struct net_device * dev,struct ethtool_cmd * cmd)5213 rtl8168_set_settings(struct net_device *dev,
5214 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
5215 struct ethtool_cmd *cmd
5216 #else
5217 const struct ethtool_link_ksettings *cmd
5218 #endif
5219 )
5220 {
5221 struct rtl8168_private *tp = netdev_priv(dev);
5222 int ret;
5223 unsigned long flags;
5224 u8 autoneg;
5225 u32 speed;
5226 u8 duplex;
5227 u32 supported, advertising;
5228
5229 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
5230 autoneg = cmd->autoneg;
5231 speed = cmd->speed;
5232 duplex = cmd->duplex;
5233 supported = cmd->supported;
5234 advertising = cmd->advertising;
5235 #else
5236 const struct ethtool_link_settings *base = &cmd->base;
5237 autoneg = base->autoneg;
5238 speed = base->speed;
5239 duplex = base->duplex;
5240 ethtool_convert_link_mode_to_legacy_u32(&supported,
5241 cmd->link_modes.supported);
5242 ethtool_convert_link_mode_to_legacy_u32(&advertising,
5243 cmd->link_modes.advertising);
5244 #endif
5245 if (advertising & ~supported)
5246 return -EINVAL;
5247
5248 spin_lock_irqsave(&tp->lock, flags);
5249 ret = rtl8168_set_speed(dev, autoneg, speed, duplex, advertising);
5250 spin_unlock_irqrestore(&tp->lock, flags);
5251
5252 return ret;
5253 }
5254
5255 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
5256 static u32
rtl8168_get_tx_csum(struct net_device * dev)5257 rtl8168_get_tx_csum(struct net_device *dev)
5258 {
5259 struct rtl8168_private *tp = netdev_priv(dev);
5260 u32 ret;
5261 unsigned long flags;
5262
5263 spin_lock_irqsave(&tp->lock, flags);
5264 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5265 ret = ((dev->features & NETIF_F_IP_CSUM) != 0);
5266 #else
5267 ret = ((dev->features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) != 0);
5268 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5269 spin_unlock_irqrestore(&tp->lock, flags);
5270
5271 return ret;
5272 }
5273
5274 static u32
rtl8168_get_rx_csum(struct net_device * dev)5275 rtl8168_get_rx_csum(struct net_device *dev)
5276 {
5277 struct rtl8168_private *tp = netdev_priv(dev);
5278 u32 ret;
5279 unsigned long flags;
5280
5281 spin_lock_irqsave(&tp->lock, flags);
5282 ret = tp->cp_cmd & RxChkSum;
5283 spin_unlock_irqrestore(&tp->lock, flags);
5284
5285 return ret;
5286 }
5287
5288 static int
rtl8168_set_tx_csum(struct net_device * dev,u32 data)5289 rtl8168_set_tx_csum(struct net_device *dev,
5290 u32 data)
5291 {
5292 struct rtl8168_private *tp = netdev_priv(dev);
5293 unsigned long flags;
5294
5295 if (tp->mcfg == CFG_METHOD_DEFAULT)
5296 return -EOPNOTSUPP;
5297
5298 spin_lock_irqsave(&tp->lock, flags);
5299
5300 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5301 if (data)
5302 dev->features |= NETIF_F_IP_CSUM;
5303 else
5304 dev->features &= ~NETIF_F_IP_CSUM;
5305 #else
5306 if (data)
5307 if ((tp->mcfg == CFG_METHOD_1) || (tp->mcfg == CFG_METHOD_2) || (tp->mcfg == CFG_METHOD_3))
5308 dev->features |= NETIF_F_IP_CSUM;
5309 else
5310 dev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
5311 else
5312 dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
5313 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5314
5315 spin_unlock_irqrestore(&tp->lock, flags);
5316
5317 return 0;
5318 }
5319
5320 static int
rtl8168_set_rx_csum(struct net_device * dev,u32 data)5321 rtl8168_set_rx_csum(struct net_device *dev,
5322 u32 data)
5323 {
5324 struct rtl8168_private *tp = netdev_priv(dev);
5325 unsigned long flags;
5326
5327 if (tp->mcfg == CFG_METHOD_DEFAULT)
5328 return -EOPNOTSUPP;
5329
5330 spin_lock_irqsave(&tp->lock, flags);
5331
5332 if (data)
5333 tp->cp_cmd |= RxChkSum;
5334 else
5335 tp->cp_cmd &= ~RxChkSum;
5336
5337 RTL_W16(tp, CPlusCmd, tp->cp_cmd);
5338
5339 spin_unlock_irqrestore(&tp->lock, flags);
5340
5341 return 0;
5342 }
5343 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
5344 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5345
5346 #ifdef CONFIG_R8168_VLAN
5347
5348 static inline u32
rtl8168_tx_vlan_tag(struct rtl8168_private * tp,struct sk_buff * skb)5349 rtl8168_tx_vlan_tag(struct rtl8168_private *tp,
5350 struct sk_buff *skb)
5351 {
5352 u32 tag;
5353
5354 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5355 tag = (tp->vlgrp && vlan_tx_tag_present(skb)) ?
5356 TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00;
5357 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
5358 tag = (vlan_tx_tag_present(skb)) ?
5359 TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00;
5360 #else
5361 tag = (skb_vlan_tag_present(skb)) ?
5362 TxVlanTag | swab16(skb_vlan_tag_get(skb)) : 0x00;
5363 #endif
5364
5365 return tag;
5366 }
5367
5368 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5369
5370 static void
rtl8168_vlan_rx_register(struct net_device * dev,struct vlan_group * grp)5371 rtl8168_vlan_rx_register(struct net_device *dev,
5372 struct vlan_group *grp)
5373 {
5374 struct rtl8168_private *tp = netdev_priv(dev);
5375 unsigned long flags;
5376
5377 spin_lock_irqsave(&tp->lock, flags);
5378 tp->vlgrp = grp;
5379 if (tp->vlgrp)
5380 tp->cp_cmd |= RxVlan;
5381 else
5382 tp->cp_cmd &= ~RxVlan;
5383 RTL_W16(tp, CPlusCmd, tp->cp_cmd);
5384 RTL_R16(tp, CPlusCmd);
5385 spin_unlock_irqrestore(&tp->lock, flags);
5386 }
5387
5388 #endif
5389
5390 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
5391 static void
rtl8168_vlan_rx_kill_vid(struct net_device * dev,unsigned short vid)5392 rtl8168_vlan_rx_kill_vid(struct net_device *dev,
5393 unsigned short vid)
5394 {
5395 struct rtl8168_private *tp = netdev_priv(dev);
5396 unsigned long flags;
5397
5398 spin_lock_irqsave(&tp->lock, flags);
5399 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
5400 if (tp->vlgrp)
5401 tp->vlgrp->vlan_devices[vid] = NULL;
5402 #else
5403 vlan_group_set_device(tp->vlgrp, vid, NULL);
5404 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
5405 spin_unlock_irqrestore(&tp->lock, flags);
5406 }
5407 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
5408
5409 static int
rtl8168_rx_vlan_skb(struct rtl8168_private * tp,struct RxDesc * desc,struct sk_buff * skb)5410 rtl8168_rx_vlan_skb(struct rtl8168_private *tp,
5411 struct RxDesc *desc,
5412 struct sk_buff *skb)
5413 {
5414 u32 opts2 = le32_to_cpu(desc->opts2);
5415 int ret = -1;
5416
5417 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
5418 if (tp->vlgrp && (opts2 & RxVlanTag)) {
5419 rtl8168_rx_hwaccel_skb(skb, tp->vlgrp,
5420 swab16(opts2 & 0xffff));
5421 ret = 0;
5422 }
5423 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
5424 if (opts2 & RxVlanTag)
5425 __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff));
5426 #else
5427 if (opts2 & RxVlanTag)
5428 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
5429 #endif
5430
5431 desc->opts2 = 0;
5432 return ret;
5433 }
5434
5435 #else /* !CONFIG_R8168_VLAN */
5436
5437 static inline u32
rtl8168_tx_vlan_tag(struct rtl8168_private * tp,struct sk_buff * skb)5438 rtl8168_tx_vlan_tag(struct rtl8168_private *tp,
5439 struct sk_buff *skb)
5440 {
5441 return 0;
5442 }
5443
5444 static int
rtl8168_rx_vlan_skb(struct rtl8168_private * tp,struct RxDesc * desc,struct sk_buff * skb)5445 rtl8168_rx_vlan_skb(struct rtl8168_private *tp,
5446 struct RxDesc *desc,
5447 struct sk_buff *skb)
5448 {
5449 return -1;
5450 }
5451
5452 #endif
5453
5454 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
5455
rtl8168_fix_features(struct net_device * dev,netdev_features_t features)5456 static netdev_features_t rtl8168_fix_features(struct net_device *dev,
5457 netdev_features_t features)
5458 {
5459 struct rtl8168_private *tp = netdev_priv(dev);
5460 unsigned long flags;
5461
5462 spin_lock_irqsave(&tp->lock, flags);
5463 if (dev->mtu > MSS_MAX)
5464 features &= ~NETIF_F_ALL_TSO;
5465 if (dev->mtu > ETH_DATA_LEN) {
5466 features &= ~NETIF_F_ALL_TSO;
5467 features &= ~NETIF_F_ALL_CSUM;
5468 }
5469 spin_unlock_irqrestore(&tp->lock, flags);
5470
5471 return features;
5472 }
5473
rtl8168_hw_set_features(struct net_device * dev,netdev_features_t features)5474 static int rtl8168_hw_set_features(struct net_device *dev,
5475 netdev_features_t features)
5476 {
5477 struct rtl8168_private *tp = netdev_priv(dev);
5478 u32 rx_config;
5479
5480 rx_config = RTL_R32(tp, RxConfig);
5481 if (features & NETIF_F_RXALL)
5482 rx_config |= (AcceptErr | AcceptRunt);
5483 else
5484 rx_config &= ~(AcceptErr | AcceptRunt);
5485
5486 RTL_W32(tp, RxConfig, rx_config);
5487
5488 if (features & NETIF_F_RXCSUM)
5489 tp->cp_cmd |= RxChkSum;
5490 else
5491 tp->cp_cmd &= ~RxChkSum;
5492
5493 if (dev->features & NETIF_F_HW_VLAN_RX)
5494 tp->cp_cmd |= RxVlan;
5495 else
5496 tp->cp_cmd &= ~RxVlan;
5497
5498 RTL_W16(tp, CPlusCmd, tp->cp_cmd);
5499 RTL_R16(tp, CPlusCmd);
5500
5501 return 0;
5502 }
5503
rtl8168_set_features(struct net_device * dev,netdev_features_t features)5504 static int rtl8168_set_features(struct net_device *dev,
5505 netdev_features_t features)
5506 {
5507 struct rtl8168_private *tp = netdev_priv(dev);
5508 unsigned long flags;
5509
5510 features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
5511
5512 spin_lock_irqsave(&tp->lock, flags);
5513 if (features ^ dev->features)
5514 rtl8168_hw_set_features(dev, features);
5515 spin_unlock_irqrestore(&tp->lock, flags);
5516
5517 return 0;
5518 }
5519
5520 #endif
5521
rtl8168_gset_xmii(struct net_device * dev,struct ethtool_cmd * cmd)5522 static void rtl8168_gset_xmii(struct net_device *dev,
5523 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
5524 struct ethtool_cmd *cmd
5525 #else
5526 struct ethtool_link_ksettings *cmd
5527 #endif
5528 )
5529 {
5530 struct rtl8168_private *tp = netdev_priv(dev);
5531 u8 status;
5532 u8 autoneg, duplex;
5533 u32 speed = 0;
5534 u16 bmcr, bmsr, anlpar, ctrl1000 = 0, stat1000 = 0;
5535 u32 supported, advertising, lp_advertising;
5536 unsigned long flags;
5537
5538 supported = SUPPORTED_10baseT_Half |
5539 SUPPORTED_10baseT_Full |
5540 SUPPORTED_100baseT_Half |
5541 SUPPORTED_100baseT_Full |
5542 SUPPORTED_1000baseT_Full |
5543 SUPPORTED_Autoneg |
5544 SUPPORTED_TP |
5545 SUPPORTED_Pause |
5546 SUPPORTED_Asym_Pause;
5547
5548 advertising = ADVERTISED_TP;
5549
5550 spin_lock_irqsave(&tp->lock, flags);
5551 rtl8168_mdio_write(tp, 0x1F, 0x0000);
5552 bmcr = rtl8168_mdio_read(tp, MII_BMCR);
5553 bmsr = rtl8168_mdio_read(tp, MII_BMSR);
5554 anlpar = rtl8168_mdio_read(tp, MII_LPA);
5555 ctrl1000 = rtl8168_mdio_read(tp, MII_CTRL1000);
5556 stat1000 = rtl8168_mdio_read(tp, MII_STAT1000);
5557 spin_unlock_irqrestore(&tp->lock, flags);
5558
5559 if (bmcr & BMCR_ANENABLE) {
5560 advertising |= ADVERTISED_Autoneg;
5561 autoneg = AUTONEG_ENABLE;
5562
5563 if (bmsr & BMSR_ANEGCOMPLETE) {
5564 lp_advertising = mii_lpa_to_ethtool_lpa_t(anlpar);
5565 lp_advertising |=
5566 mii_stat1000_to_ethtool_lpa_t(stat1000);
5567 } else {
5568 lp_advertising = 0;
5569 }
5570
5571 if (tp->phy_auto_nego_reg & ADVERTISE_10HALF)
5572 advertising |= ADVERTISED_10baseT_Half;
5573 if (tp->phy_auto_nego_reg & ADVERTISE_10FULL)
5574 advertising |= ADVERTISED_10baseT_Full;
5575 if (tp->phy_auto_nego_reg & ADVERTISE_100HALF)
5576 advertising |= ADVERTISED_100baseT_Half;
5577 if (tp->phy_auto_nego_reg & ADVERTISE_100FULL)
5578 advertising |= ADVERTISED_100baseT_Full;
5579 if (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)
5580 advertising |= ADVERTISED_1000baseT_Full;
5581 } else {
5582 autoneg = AUTONEG_DISABLE;
5583 lp_advertising = 0;
5584 }
5585
5586 status = RTL_R8(tp, PHYstatus);
5587
5588 if (status & LinkStatus) {
5589 /*link on*/
5590 if (status & _1000bpsF)
5591 speed = SPEED_1000;
5592 else if (status & _100bps)
5593 speed = SPEED_100;
5594 else if (status & _10bps)
5595 speed = SPEED_10;
5596
5597 if (status & TxFlowCtrl)
5598 advertising |= ADVERTISED_Asym_Pause;
5599
5600 if (status & RxFlowCtrl)
5601 advertising |= ADVERTISED_Pause;
5602
5603 duplex = ((status & _1000bpsF) || (status & FullDup)) ?
5604 DUPLEX_FULL : DUPLEX_HALF;
5605 } else {
5606 /*link down*/
5607 speed = SPEED_UNKNOWN;
5608 duplex = DUPLEX_UNKNOWN;
5609 }
5610
5611 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
5612 cmd->supported = supported;
5613 cmd->advertising = advertising;
5614 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)
5615 cmd->lp_advertising = lp_advertising;
5616 #endif
5617 cmd->autoneg = autoneg;
5618 cmd->speed = speed;
5619 cmd->duplex = duplex;
5620 cmd->port = PORT_TP;
5621 #else
5622 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
5623 supported);
5624 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
5625 advertising);
5626 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising,
5627 lp_advertising);
5628 cmd->base.autoneg = autoneg;
5629 cmd->base.speed = speed;
5630 cmd->base.duplex = duplex;
5631 cmd->base.port = PORT_TP;
5632 #endif
5633 }
5634
5635 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5636 static int
rtl8168_get_settings(struct net_device * dev,struct ethtool_cmd * cmd)5637 rtl8168_get_settings(struct net_device *dev,
5638 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
5639 struct ethtool_cmd *cmd
5640 #else
5641 struct ethtool_link_ksettings *cmd
5642 #endif
5643 )
5644 {
5645 struct rtl8168_private *tp = netdev_priv(dev);
5646
5647 tp->get_settings(dev, cmd);
5648
5649 return 0;
5650 }
5651
rtl8168_get_regs(struct net_device * dev,struct ethtool_regs * regs,void * p)5652 static void rtl8168_get_regs(struct net_device *dev, struct ethtool_regs *regs,
5653 void *p)
5654 {
5655 struct rtl8168_private *tp = netdev_priv(dev);
5656 void __iomem *ioaddr = tp->mmio_addr;
5657 unsigned int i;
5658 u8 *data = p;
5659 unsigned long flags;
5660
5661 if (regs->len < R8168_REGS_DUMP_SIZE)
5662 return /* -EINVAL */;
5663
5664 memset(p, 0, regs->len);
5665
5666 spin_lock_irqsave(&tp->lock, flags);
5667 for (i = 0; i < R8168_MAC_REGS_SIZE; i++)
5668 *data++ = readb(ioaddr + i);
5669 data = (u8*)p + 256;
5670
5671 rtl8168_mdio_write(tp, 0x1F, 0x0000);
5672 for (i = 0; i < R8168_PHY_REGS_SIZE/2; i++) {
5673 *(u16*)data = rtl8168_mdio_read(tp, i);
5674 data += 2;
5675 }
5676 data = (u8*)p + 256 * 2;
5677
5678 for (i = 0; i < R8168_EPHY_REGS_SIZE/2; i++) {
5679 *(u16*)data = rtl8168_ephy_read(tp, i);
5680 data += 2;
5681 }
5682 data = (u8*)p + 256 * 3;
5683
5684 switch (tp->mcfg) {
5685 case CFG_METHOD_1:
5686 case CFG_METHOD_2:
5687 case CFG_METHOD_3:
5688 /* RTL8168B does not support Extend GMAC */
5689 break;
5690 default:
5691 for (i = 0; i < R8168_ERI_REGS_SIZE; i+=4) {
5692 *(u32*)data = rtl8168_eri_read(tp, i , 4, ERIAR_ExGMAC);
5693 data += 4;
5694 }
5695 break;
5696 }
5697 spin_unlock_irqrestore(&tp->lock, flags);
5698 }
5699
5700 static u32
rtl8168_get_msglevel(struct net_device * dev)5701 rtl8168_get_msglevel(struct net_device *dev)
5702 {
5703 struct rtl8168_private *tp = netdev_priv(dev);
5704
5705 return tp->msg_enable;
5706 }
5707
5708 static void
rtl8168_set_msglevel(struct net_device * dev,u32 value)5709 rtl8168_set_msglevel(struct net_device *dev,
5710 u32 value)
5711 {
5712 struct rtl8168_private *tp = netdev_priv(dev);
5713
5714 tp->msg_enable = value;
5715 }
5716
5717 static const char rtl8168_gstrings[][ETH_GSTRING_LEN] = {
5718 "tx_packets",
5719 "rx_packets",
5720 "tx_errors",
5721 "rx_errors",
5722 "rx_missed",
5723 "align_errors",
5724 "tx_single_collisions",
5725 "tx_multi_collisions",
5726 "unicast",
5727 "broadcast",
5728 "multicast",
5729 "tx_aborted",
5730 "tx_underrun",
5731 };
5732 #endif //#LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5733
5734 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
5735 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
rtl8168_get_stats_count(struct net_device * dev)5736 static int rtl8168_get_stats_count(struct net_device *dev)
5737 {
5738 return ARRAY_SIZE(rtl8168_gstrings);
5739 }
5740 #endif //#LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5741 #else
rtl8168_get_sset_count(struct net_device * dev,int sset)5742 static int rtl8168_get_sset_count(struct net_device *dev, int sset)
5743 {
5744 switch (sset) {
5745 case ETH_SS_STATS:
5746 return ARRAY_SIZE(rtl8168_gstrings);
5747 default:
5748 return -EOPNOTSUPP;
5749 }
5750 }
5751 #endif
5752
5753 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5754 static void
rtl8168_get_ethtool_stats(struct net_device * dev,struct ethtool_stats * stats,u64 * data)5755 rtl8168_get_ethtool_stats(struct net_device *dev,
5756 struct ethtool_stats *stats,
5757 u64 *data)
5758 {
5759 struct rtl8168_private *tp = netdev_priv(dev);
5760 struct rtl8168_counters *counters;
5761 dma_addr_t paddr;
5762 u32 cmd;
5763 u32 WaitCnt;
5764 unsigned long flags;
5765
5766 ASSERT_RTNL();
5767
5768 counters = tp->tally_vaddr;
5769 paddr = tp->tally_paddr;
5770 if (!counters)
5771 return;
5772
5773 spin_lock_irqsave(&tp->lock, flags);
5774 RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32);
5775 cmd = (u64)paddr & DMA_BIT_MASK(32);
5776 RTL_W32(tp, CounterAddrLow, cmd);
5777 RTL_W32(tp, CounterAddrLow, cmd | CounterDump);
5778
5779 WaitCnt = 0;
5780 while (RTL_R32(tp, CounterAddrLow) & CounterDump) {
5781 udelay(10);
5782
5783 WaitCnt++;
5784 if (WaitCnt > 20)
5785 break;
5786 }
5787 spin_unlock_irqrestore(&tp->lock, flags);
5788
5789 data[0] = le64_to_cpu(counters->tx_packets);
5790 data[1] = le64_to_cpu(counters->rx_packets);
5791 data[2] = le64_to_cpu(counters->tx_errors);
5792 data[3] = le32_to_cpu(counters->rx_errors);
5793 data[4] = le16_to_cpu(counters->rx_missed);
5794 data[5] = le16_to_cpu(counters->align_errors);
5795 data[6] = le32_to_cpu(counters->tx_one_collision);
5796 data[7] = le32_to_cpu(counters->tx_multi_collision);
5797 data[8] = le64_to_cpu(counters->rx_unicast);
5798 data[9] = le64_to_cpu(counters->rx_broadcast);
5799 data[10] = le32_to_cpu(counters->rx_multicast);
5800 data[11] = le16_to_cpu(counters->tx_aborted);
5801 data[12] = le16_to_cpu(counters->tx_underrun);
5802 }
5803
5804 static void
rtl8168_get_strings(struct net_device * dev,u32 stringset,u8 * data)5805 rtl8168_get_strings(struct net_device *dev,
5806 u32 stringset,
5807 u8 *data)
5808 {
5809 switch (stringset) {
5810 case ETH_SS_STATS:
5811 memcpy(data, *rtl8168_gstrings, sizeof(rtl8168_gstrings));
5812 break;
5813 }
5814 }
5815 #endif //#LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
5816
rtl_get_eeprom_len(struct net_device * dev)5817 static int rtl_get_eeprom_len(struct net_device *dev)
5818 {
5819 struct rtl8168_private *tp = netdev_priv(dev);
5820
5821 return tp->eeprom_len;
5822 }
5823
rtl_get_eeprom(struct net_device * dev,struct ethtool_eeprom * eeprom,u8 * buf)5824 static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *buf)
5825 {
5826 struct rtl8168_private *tp = netdev_priv(dev);
5827 int i,j,ret;
5828 int start_w, end_w;
5829 int VPD_addr, VPD_data;
5830 u32 *eeprom_buff;
5831 u16 tmp;
5832
5833 if (tp->eeprom_type == EEPROM_TYPE_NONE) {
5834 dev_printk(KERN_DEBUG, tp_to_dev(tp), "Detect none EEPROM\n");
5835 return -EOPNOTSUPP;
5836 } else if (eeprom->len == 0 || (eeprom->offset+eeprom->len) > tp->eeprom_len) {
5837 dev_printk(KERN_DEBUG, tp_to_dev(tp), "Invalid parameter\n");
5838 return -EINVAL;
5839 }
5840
5841 switch (tp->mcfg) {
5842 case CFG_METHOD_9:
5843 case CFG_METHOD_10:
5844 VPD_addr = 0xCE;
5845 VPD_data = 0xD0;
5846 break;
5847
5848 case CFG_METHOD_1:
5849 case CFG_METHOD_2:
5850 case CFG_METHOD_3:
5851 case CFG_METHOD_11:
5852 case CFG_METHOD_12:
5853 case CFG_METHOD_13:
5854 return -EOPNOTSUPP;
5855 default:
5856 VPD_addr = 0xD2;
5857 VPD_data = 0xD4;
5858 break;
5859 }
5860
5861 start_w = eeprom->offset >> 2;
5862 end_w = (eeprom->offset + eeprom->len - 1) >> 2;
5863
5864 eeprom_buff = kmalloc(sizeof(u32)*(end_w - start_w + 1), GFP_KERNEL);
5865 if (!eeprom_buff)
5866 return -ENOMEM;
5867
5868 rtl8168_enable_cfg9346_write(tp);
5869 ret = -EFAULT;
5870 for (i=start_w; i<=end_w; i++) {
5871 pci_write_config_word(tp->pci_dev, VPD_addr, (u16)i*4);
5872 ret = -EFAULT;
5873 for (j = 0; j < 10; j++) {
5874 udelay(400);
5875 pci_read_config_word(tp->pci_dev, VPD_addr, &tmp);
5876 if (tmp&0x8000) {
5877 ret = 0;
5878 break;
5879 }
5880 }
5881
5882 if (ret)
5883 break;
5884
5885 pci_read_config_dword(tp->pci_dev, VPD_data, &eeprom_buff[i-start_w]);
5886 }
5887 rtl8168_disable_cfg9346_write(tp);
5888
5889 if (!ret)
5890 memcpy(buf, (u8 *)eeprom_buff + (eeprom->offset & 3), eeprom->len);
5891
5892 kfree(eeprom_buff);
5893
5894 return ret;
5895 }
5896
5897 #undef ethtool_op_get_link
5898 #define ethtool_op_get_link _kc_ethtool_op_get_link
_kc_ethtool_op_get_link(struct net_device * dev)5899 static u32 _kc_ethtool_op_get_link(struct net_device *dev)
5900 {
5901 return netif_carrier_ok(dev) ? 1 : 0;
5902 }
5903
5904 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
5905 #undef ethtool_op_get_sg
5906 #define ethtool_op_get_sg _kc_ethtool_op_get_sg
_kc_ethtool_op_get_sg(struct net_device * dev)5907 static u32 _kc_ethtool_op_get_sg(struct net_device *dev)
5908 {
5909 #ifdef NETIF_F_SG
5910 return (dev->features & NETIF_F_SG) != 0;
5911 #else
5912 return 0;
5913 #endif
5914 }
5915
5916 #undef ethtool_op_set_sg
5917 #define ethtool_op_set_sg _kc_ethtool_op_set_sg
_kc_ethtool_op_set_sg(struct net_device * dev,u32 data)5918 static int _kc_ethtool_op_set_sg(struct net_device *dev, u32 data)
5919 {
5920 struct rtl8168_private *tp = netdev_priv(dev);
5921
5922 if (tp->mcfg == CFG_METHOD_DEFAULT)
5923 return -EOPNOTSUPP;
5924
5925 #ifdef NETIF_F_SG
5926 if (data)
5927 dev->features |= NETIF_F_SG;
5928 else
5929 dev->features &= ~NETIF_F_SG;
5930 #endif
5931
5932 return 0;
5933 }
5934 #endif
5935
rtl8168_enable_EEE(struct rtl8168_private * tp)5936 static int rtl8168_enable_EEE(struct rtl8168_private *tp)
5937 {
5938 int ret;
5939 u16 data;
5940 u32 csi_tmp;
5941
5942 ret = 0;
5943 switch (tp->mcfg) {
5944 case CFG_METHOD_14:
5945 case CFG_METHOD_15:
5946 rtl8168_mdio_write(tp, 0x1F, 0x0007);
5947 rtl8168_mdio_write(tp, 0x1E, 0x0020);
5948 data = rtl8168_mdio_read(tp, 0x15) | 0x0100;
5949 rtl8168_mdio_write(tp, 0x15, data);
5950 rtl8168_mdio_write(tp, 0x1F, 0x0005);
5951 rtl8168_mdio_write(tp, 0x05, 0x8B85);
5952 data = rtl8168_mdio_read(tp, 0x06) | 0x2000;
5953 rtl8168_mdio_write(tp, 0x06, data);
5954 rtl8168_mdio_write(tp, 0x1F, 0x0006);
5955 rtl8168_mdio_write(tp, 0x00, 0x5A30);
5956 rtl8168_mdio_write(tp, 0x1F, 0x0000);
5957 rtl8168_mdio_write(tp, 0x0D, 0x0007);
5958 rtl8168_mdio_write(tp, 0x0E, 0x003C);
5959 rtl8168_mdio_write(tp, 0x0D, 0x4007);
5960 rtl8168_mdio_write(tp, 0x0E, 0x0006);
5961 rtl8168_mdio_write(tp, 0x0D, 0x0000);
5962 if ((RTL_R8(tp, Config4)&0x40) && (RTL_R8(tp, 0x6D) & BIT_7)) {
5963 rtl8168_mdio_write(tp, 0x1F, 0x0005);
5964 rtl8168_mdio_write(tp, 0x05, 0x8AC8);
5965 rtl8168_mdio_write(tp, 0x06, RTL_R16(tp, tp->NicCustLedValue));
5966 rtl8168_mdio_write(tp, 0x05, 0x8B82);
5967 data = rtl8168_mdio_read(tp, 0x06) | 0x0010;
5968 rtl8168_mdio_write(tp, 0x05, 0x8B82);
5969 rtl8168_mdio_write(tp, 0x06, data);
5970 rtl8168_mdio_write(tp, 0x1F, 0x0000);
5971 }
5972 break;
5973
5974 case CFG_METHOD_16:
5975 case CFG_METHOD_17:
5976 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC) | 0x0003;
5977 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
5978 rtl8168_mdio_write(tp,0x1F , 0x0004);
5979 rtl8168_mdio_write(tp,0x1F , 0x0007);
5980 rtl8168_mdio_write(tp,0x1E , 0x0020);
5981 data = rtl8168_mdio_read(tp, 0x15)|0x0100;
5982 rtl8168_mdio_write(tp,0x15 , data);
5983 rtl8168_mdio_write(tp,0x1F , 0x0002);
5984 rtl8168_mdio_write(tp,0x1F , 0x0005);
5985 rtl8168_mdio_write(tp,0x05 , 0x8B85);
5986 data = rtl8168_mdio_read(tp, 0x06)|0x2000;
5987 rtl8168_mdio_write(tp,0x06 , data);
5988 rtl8168_mdio_write(tp,0x1F , 0x0000);
5989 rtl8168_mdio_write(tp,0x0D , 0x0007);
5990 rtl8168_mdio_write(tp,0x0E , 0x003C);
5991 rtl8168_mdio_write(tp,0x0D , 0x4007);
5992 rtl8168_mdio_write(tp,0x0E , 0x0006);
5993 rtl8168_mdio_write(tp,0x0D , 0x0000);
5994 break;
5995
5996 case CFG_METHOD_18:
5997 case CFG_METHOD_19:
5998 case CFG_METHOD_20:
5999 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
6000 csi_tmp |= BIT_1 | BIT_0;
6001 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
6002 rtl8168_mdio_write(tp, 0x1F, 0x0007);
6003 rtl8168_mdio_write(tp, 0x1e, 0x0020);
6004 data = rtl8168_mdio_read(tp, 0x15);
6005 data |= BIT_8;
6006 rtl8168_mdio_write(tp, 0x15, data);
6007 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6008 rtl8168_mdio_write(tp, 0x05, 0x8B85);
6009 data = rtl8168_mdio_read(tp, 0x06);
6010 data |= BIT_13;
6011 rtl8168_mdio_write(tp, 0x06, data);
6012 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6013 rtl8168_mdio_write(tp, 0x0D, 0x0007);
6014 rtl8168_mdio_write(tp, 0x0E, 0x003C);
6015 rtl8168_mdio_write(tp, 0x0D, 0x4007);
6016 rtl8168_mdio_write(tp, 0x0E, 0x0006);
6017 rtl8168_mdio_write(tp, 0x0D, 0x0000);
6018 break;
6019
6020 case CFG_METHOD_21:
6021 case CFG_METHOD_22:
6022 case CFG_METHOD_23:
6023 case CFG_METHOD_24:
6024 case CFG_METHOD_25:
6025 case CFG_METHOD_26:
6026 case CFG_METHOD_27:
6027 case CFG_METHOD_28:
6028 case CFG_METHOD_29:
6029 case CFG_METHOD_30:
6030 case CFG_METHOD_31:
6031 case CFG_METHOD_32:
6032 case CFG_METHOD_33:
6033 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
6034 csi_tmp |= BIT_1 | BIT_0;
6035 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
6036 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6037 data = rtl8168_mdio_read(tp, 0x11);
6038 rtl8168_mdio_write(tp, 0x11, data | BIT_4);
6039 rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
6040 rtl8168_mdio_write(tp, 0x10, tp->eee_adv_t);
6041 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6042 break;
6043
6044 default:
6045 // dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEE\n");
6046 ret = -EOPNOTSUPP;
6047 break;
6048 }
6049
6050 switch (tp->mcfg) {
6051 case CFG_METHOD_29:
6052 case CFG_METHOD_30:
6053 case CFG_METHOD_31:
6054 case CFG_METHOD_32:
6055 case CFG_METHOD_33:
6056 rtl8168_mdio_write(tp, 0x1F, 0x0A4A);
6057 rtl8168_set_eth_phy_bit(tp, 0x11, BIT_9);
6058 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6059 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_7);
6060 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6061 break;
6062 }
6063
6064 /*Advanced EEE*/
6065 switch (tp->mcfg) {
6066 case CFG_METHOD_23:
6067 case CFG_METHOD_27:
6068 case CFG_METHOD_28:
6069 case CFG_METHOD_31:
6070 case CFG_METHOD_32:
6071 case CFG_METHOD_33:
6072 rtl8168_oob_mutex_lock(tp);
6073 break;
6074 }
6075
6076 switch (tp->mcfg) {
6077 case CFG_METHOD_24:
6078 case CFG_METHOD_25:
6079 case CFG_METHOD_26:
6080 case CFG_METHOD_29:
6081 case CFG_METHOD_30:
6082 case CFG_METHOD_31:
6083 case CFG_METHOD_32:
6084 case CFG_METHOD_33:
6085 rtl8168_set_phy_mcu_patch_request(tp);
6086 break;
6087 }
6088
6089 switch (tp->mcfg) {
6090 case CFG_METHOD_25:
6091 rtl8168_eri_write(tp, 0x1EA, 1, 0xFA, ERIAR_ExGMAC);
6092
6093 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6094 data = rtl8168_mdio_read(tp, 0x10);
6095 if (data & BIT_10) {
6096 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6097 data = rtl8168_mdio_read(tp, 0x16);
6098 data &= ~(BIT_1);
6099 rtl8168_mdio_write(tp, 0x16, data);
6100 } else {
6101 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6102 data = rtl8168_mdio_read(tp, 0x16);
6103 data |= BIT_1;
6104 rtl8168_mdio_write(tp, 0x16, data);
6105 }
6106 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6107 break;
6108 case CFG_METHOD_26:
6109 data = rtl8168_mac_ocp_read(tp, 0xE052);
6110 data |= BIT_0;
6111 rtl8168_mac_ocp_write(tp, 0xE052, data);
6112 data = rtl8168_mac_ocp_read(tp, 0xE056);
6113 data &= 0xFF0F;
6114 data |= (BIT_4 | BIT_5 | BIT_6);
6115 rtl8168_mac_ocp_write(tp, 0xE056, data);
6116
6117 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6118 data = rtl8168_mdio_read(tp, 0x10);
6119 if (data & BIT_10) {
6120 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6121 data = rtl8168_mdio_read(tp, 0x16);
6122 data &= ~(BIT_1);
6123 rtl8168_mdio_write(tp, 0x16, data);
6124 } else {
6125 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6126 data = rtl8168_mdio_read(tp, 0x16);
6127 data |= BIT_1;
6128 rtl8168_mdio_write(tp, 0x16, data);
6129 }
6130 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6131 break;
6132 case CFG_METHOD_27:
6133 case CFG_METHOD_28:
6134 data = rtl8168_mac_ocp_read(tp, 0xE052);
6135 data &= ~BIT_0;
6136 rtl8168_mac_ocp_write(tp, 0xE052, data);
6137 data = rtl8168_mac_ocp_read(tp, 0xE056);
6138 data &= 0xFF0F;
6139 data |= (BIT_4 | BIT_5 | BIT_6);
6140 rtl8168_mac_ocp_write(tp, 0xE056, data);
6141 break;
6142 case CFG_METHOD_29:
6143 case CFG_METHOD_30:
6144 data = rtl8168_mac_ocp_read(tp, 0xE052);
6145 data &= ~(BIT_0);
6146 rtl8168_mac_ocp_write(tp, 0xE052, data);
6147
6148 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6149 data = rtl8168_mdio_read(tp, 0x10) | BIT_15;
6150 rtl8168_mdio_write(tp, 0x10, data);
6151
6152 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
6153 data = rtl8168_mdio_read(tp, 0x11) | BIT_13 | BIT_14;
6154 data &= ~(BIT_12);
6155 rtl8168_mdio_write(tp, 0x11, data);
6156 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6157 break;
6158 case CFG_METHOD_31:
6159 case CFG_METHOD_32:
6160 case CFG_METHOD_33:
6161 /*
6162 data = rtl8168_mac_ocp_read(tp, 0xE052);
6163 data |= BIT_0;
6164 rtl8168_mac_ocp_write(tp, 0xE052, data);
6165 */
6166
6167 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6168 data = rtl8168_mdio_read(tp, 0x10) | BIT_15;
6169 rtl8168_mdio_write(tp, 0x10, data);
6170
6171 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
6172 data = rtl8168_mdio_read(tp, 0x11) | BIT_13 | BIT_14;
6173 data &= ~(BIT_12);
6174 rtl8168_mdio_write(tp, 0x11, data);
6175 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6176 break;
6177 }
6178
6179 switch (tp->mcfg) {
6180 case CFG_METHOD_24:
6181 case CFG_METHOD_25:
6182 case CFG_METHOD_26:
6183 case CFG_METHOD_29:
6184 case CFG_METHOD_30:
6185 case CFG_METHOD_31:
6186 case CFG_METHOD_32:
6187 case CFG_METHOD_33:
6188 rtl8168_clear_phy_mcu_patch_request(tp);
6189 break;
6190 }
6191
6192 switch (tp->mcfg) {
6193 case CFG_METHOD_23:
6194 case CFG_METHOD_27:
6195 case CFG_METHOD_28:
6196 case CFG_METHOD_31:
6197 case CFG_METHOD_32:
6198 case CFG_METHOD_33:
6199 rtl8168_oob_mutex_unlock(tp);
6200 break;
6201 }
6202
6203 return ret;
6204 }
6205
rtl8168_disable_EEE(struct rtl8168_private * tp)6206 static int rtl8168_disable_EEE(struct rtl8168_private *tp)
6207 {
6208 int ret;
6209 u16 data;
6210 u32 csi_tmp;
6211
6212 ret = 0;
6213 switch (tp->mcfg) {
6214 case CFG_METHOD_14:
6215 case CFG_METHOD_15:
6216 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6217 rtl8168_mdio_write(tp, 0x05, 0x8B85);
6218 data = rtl8168_mdio_read(tp, 0x06) & ~0x2000;
6219 rtl8168_mdio_write(tp, 0x06, data);
6220 rtl8168_mdio_write(tp, 0x1F, 0x0007);
6221 rtl8168_mdio_write(tp, 0x1E, 0x0020);
6222 data = rtl8168_mdio_read(tp, 0x15) & ~0x0100;
6223 rtl8168_mdio_write(tp, 0x15, data);
6224 rtl8168_mdio_write(tp, 0x1F, 0x0006);
6225 rtl8168_mdio_write(tp, 0x00, 0x5A00);
6226 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6227 rtl8168_mdio_write(tp, 0x0D, 0x0007);
6228 rtl8168_mdio_write(tp, 0x0E, 0x003C);
6229 rtl8168_mdio_write(tp, 0x0D, 0x4007);
6230 rtl8168_mdio_write(tp, 0x0E, 0x0000);
6231 rtl8168_mdio_write(tp, 0x0D, 0x0000);
6232 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6233 if (RTL_R8(tp, Config4) & 0x40) {
6234 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6235 rtl8168_mdio_write(tp, 0x05, 0x8B82);
6236 data = rtl8168_mdio_read(tp, 0x06) & ~0x0010;
6237 rtl8168_mdio_write(tp, 0x05, 0x8B82);
6238 rtl8168_mdio_write(tp, 0x06, data);
6239 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6240 }
6241 break;
6242
6243 case CFG_METHOD_16:
6244 case CFG_METHOD_17:
6245 csi_tmp = rtl8168_eri_read(tp, 0x1B0,4, ERIAR_ExGMAC)& ~0x0003;
6246 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
6247 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6248 rtl8168_mdio_write(tp, 0x05, 0x8B85);
6249 data = rtl8168_mdio_read(tp, 0x06) & ~0x2000;
6250 rtl8168_mdio_write(tp, 0x06, data);
6251 rtl8168_mdio_write(tp, 0x1F, 0x0004);
6252 rtl8168_mdio_write(tp, 0x1F, 0x0007);
6253 rtl8168_mdio_write(tp, 0x1E, 0x0020);
6254 data = rtl8168_mdio_read(tp, 0x15) & ~0x0100;
6255 rtl8168_mdio_write(tp,0x15 , data);
6256 rtl8168_mdio_write(tp, 0x1F, 0x0002);
6257 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6258 rtl8168_mdio_write(tp, 0x0D, 0x0007);
6259 rtl8168_mdio_write(tp, 0x0E, 0x003C);
6260 rtl8168_mdio_write(tp, 0x0D, 0x4007);
6261 rtl8168_mdio_write(tp, 0x0E, 0x0000);
6262 rtl8168_mdio_write(tp, 0x0D, 0x0000);
6263 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6264 break;
6265
6266 case CFG_METHOD_18:
6267 case CFG_METHOD_19:
6268 case CFG_METHOD_20:
6269 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
6270 csi_tmp &= ~(BIT_1 | BIT_0);
6271 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
6272 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6273 rtl8168_mdio_write(tp, 0x05, 0x8B85);
6274 data = rtl8168_mdio_read(tp, 0x06);
6275 data &= ~BIT_13;
6276 rtl8168_mdio_write(tp, 0x06, data);
6277 rtl8168_mdio_write(tp, 0x1F, 0x0007);
6278 rtl8168_mdio_write(tp, 0x1e, 0x0020);
6279 data = rtl8168_mdio_read(tp, 0x15);
6280 data &= ~BIT_8;
6281 rtl8168_mdio_write(tp, 0x15, data);
6282 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6283 rtl8168_mdio_write(tp, 0x0D, 0x0007);
6284 rtl8168_mdio_write(tp, 0x0E, 0x003C);
6285 rtl8168_mdio_write(tp, 0x0D, 0x4007);
6286 rtl8168_mdio_write(tp, 0x0E, 0x0000);
6287 rtl8168_mdio_write(tp, 0x0D, 0x0000);
6288 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6289 break;
6290
6291 case CFG_METHOD_21:
6292 case CFG_METHOD_22:
6293 case CFG_METHOD_23:
6294 case CFG_METHOD_24:
6295 case CFG_METHOD_25:
6296 case CFG_METHOD_26:
6297 case CFG_METHOD_27:
6298 case CFG_METHOD_28:
6299 case CFG_METHOD_29:
6300 case CFG_METHOD_30:
6301 case CFG_METHOD_31:
6302 case CFG_METHOD_32:
6303 case CFG_METHOD_33:
6304 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
6305 csi_tmp &= ~(BIT_1 | BIT_0);
6306 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
6307 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6308 data = rtl8168_mdio_read(tp, 0x11);
6309 rtl8168_mdio_write(tp, 0x11, data & ~BIT_4);
6310 rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
6311 rtl8168_mdio_write(tp, 0x10, 0x0000);
6312 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6313 break;
6314
6315 default:
6316 // dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEE\n");
6317 ret = -EOPNOTSUPP;
6318 break;
6319 }
6320
6321 switch (tp->mcfg) {
6322 case CFG_METHOD_29:
6323 case CFG_METHOD_30:
6324 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6325 rtl8168_clear_eth_phy_bit(tp, 0x14, BIT_7);
6326 rtl8168_mdio_write(tp, 0x1F, 0x0A4A);
6327 rtl8168_clear_eth_phy_bit(tp, 0x11, BIT_9);
6328 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6329 break;
6330 }
6331
6332 /*Advanced EEE*/
6333 switch (tp->mcfg) {
6334 case CFG_METHOD_23:
6335 case CFG_METHOD_27:
6336 case CFG_METHOD_28:
6337 case CFG_METHOD_31:
6338 case CFG_METHOD_32:
6339 case CFG_METHOD_33:
6340 rtl8168_oob_mutex_lock(tp);
6341 break;
6342 }
6343
6344 switch (tp->mcfg) {
6345 case CFG_METHOD_24:
6346 case CFG_METHOD_25:
6347 case CFG_METHOD_26:
6348 case CFG_METHOD_29:
6349 case CFG_METHOD_30:
6350 case CFG_METHOD_31:
6351 case CFG_METHOD_32:
6352 case CFG_METHOD_33:
6353 rtl8168_set_phy_mcu_patch_request(tp);
6354 break;
6355 }
6356
6357 switch (tp->mcfg) {
6358 case CFG_METHOD_25:
6359 rtl8168_eri_write(tp, 0x1EA, 1, 0x00, ERIAR_ExGMAC);
6360
6361 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6362 data = rtl8168_mdio_read(tp, 0x16);
6363 data &= ~(BIT_1);
6364 rtl8168_mdio_write(tp, 0x16, data);
6365 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6366 break;
6367 case CFG_METHOD_26:
6368 data = rtl8168_mac_ocp_read(tp, 0xE052);
6369 data &= ~(BIT_0);
6370 rtl8168_mac_ocp_write(tp, 0xE052, data);
6371
6372 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
6373 data = rtl8168_mdio_read(tp, 0x16);
6374 data &= ~(BIT_1);
6375 rtl8168_mdio_write(tp, 0x16, data);
6376 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6377 break;
6378 case CFG_METHOD_27:
6379 case CFG_METHOD_28:
6380 data = rtl8168_mac_ocp_read(tp, 0xE052);
6381 data &= ~(BIT_0);
6382 rtl8168_mac_ocp_write(tp, 0xE052, data);
6383 break;
6384 case CFG_METHOD_29:
6385 case CFG_METHOD_30:
6386 case CFG_METHOD_31:
6387 case CFG_METHOD_32:
6388 case CFG_METHOD_33:
6389 data = rtl8168_mac_ocp_read(tp, 0xE052);
6390 data &= ~(BIT_0);
6391 rtl8168_mac_ocp_write(tp, 0xE052, data);
6392
6393 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6394 data = rtl8168_mdio_read(tp, 0x10) & ~(BIT_15);
6395 rtl8168_mdio_write(tp, 0x10, data);
6396
6397 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
6398 data = rtl8168_mdio_read(tp, 0x11) & ~(BIT_12 | BIT_13 | BIT_14);
6399 rtl8168_mdio_write(tp, 0x11, data);
6400 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6401 break;
6402 }
6403
6404 switch (tp->mcfg) {
6405 case CFG_METHOD_24:
6406 case CFG_METHOD_25:
6407 case CFG_METHOD_26:
6408 case CFG_METHOD_29:
6409 case CFG_METHOD_30:
6410 case CFG_METHOD_31:
6411 case CFG_METHOD_32:
6412 case CFG_METHOD_33:
6413 rtl8168_clear_phy_mcu_patch_request(tp);
6414 break;
6415 }
6416
6417 switch (tp->mcfg) {
6418 case CFG_METHOD_23:
6419 case CFG_METHOD_27:
6420 case CFG_METHOD_28:
6421 case CFG_METHOD_31:
6422 case CFG_METHOD_32:
6423 case CFG_METHOD_33:
6424 rtl8168_oob_mutex_unlock(tp);
6425 break;
6426 }
6427
6428 return ret;
6429 }
6430
rtl_nway_reset(struct net_device * dev)6431 static int rtl_nway_reset(struct net_device *dev)
6432 {
6433 struct rtl8168_private *tp = netdev_priv(dev);
6434 unsigned long flags;
6435 int ret, bmcr;
6436
6437 spin_lock_irqsave(&tp->lock, flags);
6438
6439 if (unlikely(tp->rtk_enable_diag)) {
6440 spin_unlock_irqrestore(&tp->lock, flags);
6441 return -EBUSY;
6442 }
6443
6444 /* if autoneg is off, it's an error */
6445 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6446 bmcr = rtl8168_mdio_read(tp, MII_BMCR);
6447
6448 if (bmcr & BMCR_ANENABLE) {
6449 bmcr |= BMCR_ANRESTART;
6450 rtl8168_mdio_write(tp, MII_BMCR, bmcr);
6451 ret = 0;
6452 } else {
6453 ret = -EINVAL;
6454 }
6455
6456 spin_unlock_irqrestore(&tp->lock, flags);
6457
6458 return ret;
6459 }
6460
6461 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
6462 static int
rtl_ethtool_get_eee(struct net_device * net,struct ethtool_eee * eee)6463 rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *eee)
6464 {
6465 struct rtl8168_private *tp = netdev_priv(net);
6466 u32 lp, adv, supported = 0;
6467 unsigned long flags;
6468 u16 val;
6469
6470 switch (tp->mcfg) {
6471 case CFG_METHOD_21 ... CFG_METHOD_33:
6472 break;
6473 default:
6474 return -EOPNOTSUPP;
6475 }
6476
6477 spin_lock_irqsave(&tp->lock, flags);
6478
6479 if (unlikely(tp->rtk_enable_diag)) {
6480 spin_unlock_irqrestore(&tp->lock, flags);
6481 return -EBUSY;
6482 }
6483
6484 rtl8168_mdio_write(tp, 0x1F, 0x0A5C);
6485 val = rtl8168_mdio_read(tp, 0x12);
6486 supported = mmd_eee_cap_to_ethtool_sup_t(val);
6487
6488 rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
6489 val = rtl8168_mdio_read(tp, 0x10);
6490 adv = mmd_eee_adv_to_ethtool_adv_t(val);
6491
6492 val = rtl8168_mdio_read(tp, 0x11);
6493 lp = mmd_eee_adv_to_ethtool_adv_t(val);
6494
6495 val = rtl8168_eri_read(tp, 0x1B0, 2, ERIAR_ExGMAC);
6496 val &= BIT_1 | BIT_0;
6497
6498 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6499
6500 spin_unlock_irqrestore(&tp->lock, flags);
6501
6502 eee->eee_enabled = !!val;
6503 eee->eee_active = !!(supported & adv & lp);
6504 eee->supported = supported;
6505 eee->advertised = adv;
6506 eee->lp_advertised = lp;
6507
6508 return 0;
6509 }
6510
6511 static int
rtl_ethtool_set_eee(struct net_device * net,struct ethtool_eee * eee)6512 rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *eee)
6513 {
6514 struct rtl8168_private *tp = netdev_priv(net);
6515 unsigned long flags;
6516
6517 switch (tp->mcfg) {
6518 case CFG_METHOD_21 ... CFG_METHOD_33:
6519 break;
6520 default:
6521 return -EOPNOTSUPP;
6522 }
6523
6524 if (HW_SUPP_SERDES_PHY(tp) ||
6525 !HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) ||
6526 tp->DASH)
6527 return -EOPNOTSUPP;
6528
6529 spin_lock_irqsave(&tp->lock, flags);
6530
6531 if (unlikely(tp->rtk_enable_diag)) {
6532 spin_unlock_irqrestore(&tp->lock, flags);
6533 return -EBUSY;
6534 }
6535
6536 tp->eee_enabled = eee->eee_enabled;
6537 tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(eee->advertised);
6538
6539 if (tp->eee_enabled)
6540 rtl8168_enable_EEE(tp);
6541 else
6542 rtl8168_disable_EEE(tp);
6543
6544 spin_unlock_irqrestore(&tp->lock, flags);
6545
6546 rtl_nway_reset(net);
6547
6548 return 0;
6549 }
6550 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
6551
6552 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
6553 static const struct ethtool_ops rtl8168_ethtool_ops = {
6554 .get_drvinfo = rtl8168_get_drvinfo,
6555 .get_regs_len = rtl8168_get_regs_len,
6556 .get_link = ethtool_op_get_link,
6557 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
6558 .get_settings = rtl8168_get_settings,
6559 .set_settings = rtl8168_set_settings,
6560 #else
6561 .get_link_ksettings = rtl8168_get_settings,
6562 .set_link_ksettings = rtl8168_set_settings,
6563 #endif
6564 .get_msglevel = rtl8168_get_msglevel,
6565 .set_msglevel = rtl8168_set_msglevel,
6566 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
6567 .get_rx_csum = rtl8168_get_rx_csum,
6568 .set_rx_csum = rtl8168_set_rx_csum,
6569 .get_tx_csum = rtl8168_get_tx_csum,
6570 .set_tx_csum = rtl8168_set_tx_csum,
6571 .get_sg = ethtool_op_get_sg,
6572 .set_sg = ethtool_op_set_sg,
6573 #ifdef NETIF_F_TSO
6574 .get_tso = ethtool_op_get_tso,
6575 .set_tso = ethtool_op_set_tso,
6576 #endif
6577 #endif
6578 .get_regs = rtl8168_get_regs,
6579 .get_wol = rtl8168_get_wol,
6580 .set_wol = rtl8168_set_wol,
6581 .get_strings = rtl8168_get_strings,
6582 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
6583 .get_stats_count = rtl8168_get_stats_count,
6584 #else
6585 .get_sset_count = rtl8168_get_sset_count,
6586 #endif
6587 .get_ethtool_stats = rtl8168_get_ethtool_stats,
6588 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
6589 #ifdef ETHTOOL_GPERMADDR
6590 .get_perm_addr = ethtool_op_get_perm_addr,
6591 #endif
6592 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
6593 .get_eeprom = rtl_get_eeprom,
6594 .get_eeprom_len = rtl_get_eeprom_len,
6595 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
6596 .get_ts_info = ethtool_op_get_ts_info,
6597 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
6598 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
6599 .get_eee = rtl_ethtool_get_eee,
6600 .set_eee = rtl_ethtool_set_eee,
6601 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
6602 .nway_reset = rtl_nway_reset,
6603 };
6604 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
6605
6606 #if 0
6607
6608 static int rtl8168_enable_green_feature(struct rtl8168_private *tp)
6609 {
6610 u16 gphy_val;
6611 unsigned long flags;
6612
6613 switch (tp->mcfg) {
6614 case CFG_METHOD_14:
6615 case CFG_METHOD_15:
6616 rtl8168_mdio_write(tp, 0x1F, 0x0003);
6617 gphy_val = rtl8168_mdio_read(tp, 0x10) | 0x0400;
6618 rtl8168_mdio_write(tp, 0x10, gphy_val);
6619 gphy_val = rtl8168_mdio_read(tp, 0x19) | 0x0001;
6620 rtl8168_mdio_write(tp, 0x19, gphy_val);
6621 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6622 gphy_val = rtl8168_mdio_read(tp, 0x01) & ~0x0100;
6623 rtl8168_mdio_write(tp, 0x01, gphy_val);
6624 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6625 rtl8168_mdio_write(tp, 0x00, 0x9200);
6626 mdelay(20);
6627 break;
6628
6629 case CFG_METHOD_17:
6630 case CFG_METHOD_18:
6631 case CFG_METHOD_19:
6632 case CFG_METHOD_20:
6633 rtl8168_mdio_write(tp, 0x1f, 0x0003);
6634 gphy_val = rtl8168_mdio_read(tp, 0x10);
6635 gphy_val |= BIT_10;
6636 rtl8168_mdio_write(tp, 0x10, gphy_val);
6637 gphy_val = rtl8168_mdio_read(tp, 0x19);
6638 gphy_val |= BIT_0;
6639 rtl8168_mdio_write(tp, 0x19, gphy_val);
6640 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6641 gphy_val = rtl8168_mdio_read(tp, 0x01);
6642 gphy_val |= BIT_8;
6643 rtl8168_mdio_write(tp, 0x01, gphy_val);
6644 rtl8168_mdio_write(tp, 0x1f, 0x0000);
6645 rtl8168_mdio_write(tp, 0x00, 0x9200);
6646 break;
6647 case CFG_METHOD_21:
6648 case CFG_METHOD_23:
6649 case CFG_METHOD_24:
6650 case CFG_METHOD_25:
6651 case CFG_METHOD_26:
6652 case CFG_METHOD_27:
6653 case CFG_METHOD_28:
6654 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6655 rtl8168_mdio_write(tp, 0x13, 0x8011);
6656 rtl8168_set_eth_phy_bit( tp, 0x14, BIT_14 );
6657 rtl8168_mdio_write(tp, 0x1F, 0x0A40);
6658 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6659 rtl8168_mdio_write(tp, 0x00, 0x9200);
6660 break;
6661 case CFG_METHOD_29:
6662 case CFG_METHOD_30:
6663 case CFG_METHOD_31:
6664 case CFG_METHOD_32:
6665 case CFG_METHOD_33:
6666 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6667 rtl8168_mdio_write(tp, 0x13, 0x8045);
6668 rtl8168_mdio_write(tp, 0x14, 0x0000);
6669 rtl8168_mdio_write(tp, 0x13, 0x804d);
6670 rtl8168_mdio_write(tp, 0x14, 0x1222);
6671 rtl8168_mdio_write(tp, 0x13, 0x805d);
6672 rtl8168_mdio_write(tp, 0x14, 0x0022);
6673 rtl8168_mdio_write(tp, 0x13, 0x8011);
6674 rtl8168_set_eth_phy_bit( tp, 0x14, BIT_15 );
6675 rtl8168_mdio_write(tp, 0x1F, 0x0A40);
6676 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6677 rtl8168_mdio_write(tp, 0x00, 0x9200);
6678 break;
6679 default:
6680 dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support Green Feature\n");
6681 break;
6682 }
6683
6684 return 0;
6685 }
6686
6687 static int rtl8168_disable_green_feature(struct rtl8168_private *tp)
6688 {
6689 u16 gphy_val;
6690 unsigned long flags;
6691
6692 switch (tp->mcfg) {
6693 case CFG_METHOD_14:
6694 case CFG_METHOD_15:
6695 rtl8168_mdio_write(tp, 0x1F, 0x0005);
6696 gphy_val = rtl8168_mdio_read(tp, 0x01) | 0x0100;
6697 rtl8168_mdio_write(tp, 0x01, gphy_val);
6698 rtl8168_mdio_write(tp, 0x1F, 0x0003);
6699 gphy_val = rtl8168_mdio_read(tp, 0x10) & ~0x0400;
6700 rtl8168_mdio_write(tp, 0x10, gphy_val);
6701 gphy_val = rtl8168_mdio_read(tp, 0x19) & ~0x0001;
6702 rtl8168_mdio_write(tp, 0x19, gphy_val);
6703 rtl8168_mdio_write(tp, 0x1F, 0x0002);
6704 gphy_val = rtl8168_mdio_read(tp, 0x06) & ~0x7000;
6705 gphy_val |= 0x3000;
6706 rtl8168_mdio_write(tp, 0x06, gphy_val);
6707 gphy_val = rtl8168_mdio_read(tp, 0x0D) & 0x0700;
6708 gphy_val |= 0x0500;
6709 rtl8168_mdio_write(tp, 0x0D, gphy_val);
6710 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6711 break;
6712
6713 case CFG_METHOD_17:
6714 case CFG_METHOD_18:
6715 case CFG_METHOD_19:
6716 case CFG_METHOD_20:
6717 rtl8168_mdio_write(tp, 0x1f, 0x0003);
6718 gphy_val = rtl8168_mdio_read(tp, 0x19);
6719 gphy_val &= ~BIT_0;
6720 rtl8168_mdio_write(tp, 0x19, gphy_val);
6721 gphy_val = rtl8168_mdio_read(tp, 0x10);
6722 gphy_val &= ~BIT_10;
6723 rtl8168_mdio_write(tp, 0x10, gphy_val);
6724 rtl8168_mdio_write(tp, 0x1f, 0x0000);
6725 break;
6726 case CFG_METHOD_21:
6727 case CFG_METHOD_23:
6728 case CFG_METHOD_24:
6729 case CFG_METHOD_25:
6730 case CFG_METHOD_26:
6731 case CFG_METHOD_27:
6732 case CFG_METHOD_28:
6733 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6734 rtl8168_mdio_write(tp, 0x13, 0x8011);
6735 rtl8168_clear_eth_phy_bit( tp, 0x14, BIT_14 );
6736 rtl8168_mdio_write(tp, 0x1F, 0x0A40);
6737 rtl8168_mdio_write(tp, 0x00, 0x9200);
6738 break;
6739 case CFG_METHOD_29:
6740 case CFG_METHOD_30:
6741 case CFG_METHOD_31:
6742 case CFG_METHOD_32:
6743 case CFG_METHOD_33:
6744 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
6745 rtl8168_mdio_write(tp, 0x13, 0x8045);
6746 rtl8168_mdio_write(tp, 0x14, 0x2444);
6747 rtl8168_mdio_write(tp, 0x13, 0x804d);
6748 rtl8168_mdio_write(tp, 0x14, 0x2444);
6749 rtl8168_mdio_write(tp, 0x13, 0x805d);
6750 rtl8168_mdio_write(tp, 0x14, 0x2444);
6751 rtl8168_mdio_write(tp, 0x13, 0x8011);
6752 rtl8168_set_eth_phy_bit( tp, 0x14, BIT_15 );
6753 rtl8168_mdio_write(tp, 0x1F, 0x0A40);
6754 rtl8168_mdio_write(tp, 0x1F, 0x0000);
6755 rtl8168_mdio_write(tp, 0x00, 0x9200);
6756 break;
6757 default:
6758 dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support Green Feature\n");
6759 break;
6760 }
6761
6762 return 0;
6763 }
6764
6765 #endif
6766
rtl8168_get_mac_version(struct rtl8168_private * tp)6767 static void rtl8168_get_mac_version(struct rtl8168_private *tp)
6768 {
6769 u32 reg,val32;
6770 u32 ICVerID;
6771
6772 val32 = RTL_R32(tp, TxConfig);
6773 reg = val32 & 0x7c800000;
6774 ICVerID = val32 & 0x00700000;
6775
6776 switch (reg) {
6777 case 0x30000000:
6778 tp->mcfg = CFG_METHOD_1;
6779 tp->efuse_ver = EFUSE_NOT_SUPPORT;
6780 break;
6781 case 0x38000000:
6782 if (ICVerID == 0x00000000) {
6783 tp->mcfg = CFG_METHOD_2;
6784 } else if (ICVerID == 0x00500000) {
6785 tp->mcfg = CFG_METHOD_3;
6786 } else {
6787 tp->mcfg = CFG_METHOD_3;
6788 tp->HwIcVerUnknown = TRUE;
6789 }
6790 tp->efuse_ver = EFUSE_NOT_SUPPORT;
6791 break;
6792 case 0x3C000000:
6793 if (ICVerID == 0x00000000) {
6794 tp->mcfg = CFG_METHOD_4;
6795 } else if (ICVerID == 0x00200000) {
6796 tp->mcfg = CFG_METHOD_5;
6797 } else if (ICVerID == 0x00400000) {
6798 tp->mcfg = CFG_METHOD_6;
6799 } else {
6800 tp->mcfg = CFG_METHOD_6;
6801 tp->HwIcVerUnknown = TRUE;
6802 }
6803 tp->efuse_ver = EFUSE_NOT_SUPPORT;
6804 break;
6805 case 0x3C800000:
6806 if (ICVerID == 0x00100000) {
6807 tp->mcfg = CFG_METHOD_7;
6808 } else if (ICVerID == 0x00300000) {
6809 tp->mcfg = CFG_METHOD_8;
6810 } else {
6811 tp->mcfg = CFG_METHOD_8;
6812 tp->HwIcVerUnknown = TRUE;
6813 }
6814 tp->efuse_ver = EFUSE_NOT_SUPPORT;
6815 break;
6816 case 0x28000000:
6817 if (ICVerID == 0x00100000) {
6818 tp->mcfg = CFG_METHOD_9;
6819 } else if (ICVerID == 0x00300000) {
6820 tp->mcfg = CFG_METHOD_10;
6821 } else {
6822 tp->mcfg = CFG_METHOD_10;
6823 tp->HwIcVerUnknown = TRUE;
6824 }
6825 tp->efuse_ver = EFUSE_SUPPORT_V1;
6826 break;
6827 case 0x28800000:
6828 if (ICVerID == 0x00000000) {
6829 tp->mcfg = CFG_METHOD_11;
6830 } else if (ICVerID == 0x00200000) {
6831 tp->mcfg = CFG_METHOD_12;
6832 RTL_W32(tp, 0xD0, RTL_R32(tp, 0xD0) | 0x00020000);
6833 } else if (ICVerID == 0x00300000) {
6834 tp->mcfg = CFG_METHOD_13;
6835 } else {
6836 tp->mcfg = CFG_METHOD_13;
6837 tp->HwIcVerUnknown = TRUE;
6838 }
6839 tp->efuse_ver = EFUSE_SUPPORT_V1;
6840 break;
6841 case 0x2C000000:
6842 if (ICVerID == 0x00100000) {
6843 tp->mcfg = CFG_METHOD_14;
6844 } else if (ICVerID == 0x00200000) {
6845 tp->mcfg = CFG_METHOD_15;
6846 } else {
6847 tp->mcfg = CFG_METHOD_15;
6848 tp->HwIcVerUnknown = TRUE;
6849 }
6850 tp->efuse_ver = EFUSE_SUPPORT_V2;
6851 break;
6852 case 0x2C800000:
6853 if (ICVerID == 0x00000000) {
6854 tp->mcfg = CFG_METHOD_16;
6855 } else if (ICVerID == 0x00100000) {
6856 tp->mcfg = CFG_METHOD_17;
6857 } else {
6858 tp->mcfg = CFG_METHOD_17;
6859 tp->HwIcVerUnknown = TRUE;
6860 }
6861 tp->efuse_ver = EFUSE_SUPPORT_V3;
6862 break;
6863 case 0x48000000:
6864 if (ICVerID == 0x00000000) {
6865 tp->mcfg = CFG_METHOD_18;
6866 } else if (ICVerID == 0x00100000) {
6867 tp->mcfg = CFG_METHOD_19;
6868 } else {
6869 tp->mcfg = CFG_METHOD_19;
6870 tp->HwIcVerUnknown = TRUE;
6871 }
6872 tp->efuse_ver = EFUSE_SUPPORT_V3;
6873 break;
6874 case 0x48800000:
6875 if (ICVerID == 0x00000000) {
6876 tp->mcfg = CFG_METHOD_20;
6877 } else {
6878 tp->mcfg = CFG_METHOD_20;
6879 tp->HwIcVerUnknown = TRUE;
6880 }
6881
6882 tp->efuse_ver = EFUSE_SUPPORT_V3;
6883 break;
6884 case 0x4C000000:
6885 if (ICVerID == 0x00000000) {
6886 tp->mcfg = CFG_METHOD_21;
6887 } else if (ICVerID == 0x00100000) {
6888 tp->mcfg = CFG_METHOD_22;
6889 } else {
6890 tp->mcfg = CFG_METHOD_22;
6891 tp->HwIcVerUnknown = TRUE;
6892 }
6893 tp->efuse_ver = EFUSE_SUPPORT_V3;
6894 break;
6895 case 0x50000000:
6896 if (ICVerID == 0x00000000) {
6897 tp->mcfg = CFG_METHOD_23;
6898 } else if (ICVerID == 0x00100000) {
6899 tp->mcfg = CFG_METHOD_27;
6900 } else if (ICVerID == 0x00200000) {
6901 tp->mcfg = CFG_METHOD_28;
6902 } else {
6903 tp->mcfg = CFG_METHOD_28;
6904 tp->HwIcVerUnknown = TRUE;
6905 }
6906 tp->efuse_ver = EFUSE_SUPPORT_V3;
6907 break;
6908 case 0x50800000:
6909 if (ICVerID == 0x00000000) {
6910 tp->mcfg = CFG_METHOD_24;
6911 } else if (ICVerID == 0x00100000) {
6912 tp->mcfg = CFG_METHOD_25;
6913 } else {
6914 tp->mcfg = CFG_METHOD_25;
6915 tp->HwIcVerUnknown = TRUE;
6916 }
6917 tp->efuse_ver = EFUSE_SUPPORT_V3;
6918 break;
6919 case 0x5C800000:
6920 if (ICVerID == 0x00000000) {
6921 tp->mcfg = CFG_METHOD_26;
6922 } else {
6923 tp->mcfg = CFG_METHOD_26;
6924 tp->HwIcVerUnknown = TRUE;
6925 }
6926
6927 tp->efuse_ver = EFUSE_SUPPORT_V3;
6928 break;
6929 case 0x54000000:
6930 if (ICVerID == 0x00000000) {
6931 tp->mcfg = CFG_METHOD_29;
6932 } else if (ICVerID == 0x00100000) {
6933 tp->mcfg = CFG_METHOD_30;
6934 } else {
6935 tp->mcfg = CFG_METHOD_30;
6936 tp->HwIcVerUnknown = TRUE;
6937 }
6938
6939 tp->efuse_ver = EFUSE_SUPPORT_V3;
6940 break;
6941 case 0x54800000:
6942 if (ICVerID == 0x00100000) {
6943 tp->mcfg = CFG_METHOD_31;
6944 } else if (ICVerID == 0x00200000) {
6945 tp->mcfg = CFG_METHOD_32;
6946 } else if (ICVerID == 0x00300000) {
6947 tp->mcfg = CFG_METHOD_33;
6948 } else {
6949 tp->mcfg = CFG_METHOD_33;
6950 tp->HwIcVerUnknown = TRUE;
6951 }
6952
6953 tp->efuse_ver = EFUSE_SUPPORT_V3;
6954 break;
6955 default:
6956 printk("unknown chip version (%x)\n",reg);
6957 tp->mcfg = CFG_METHOD_DEFAULT;
6958 tp->HwIcVerUnknown = TRUE;
6959 tp->efuse_ver = EFUSE_NOT_SUPPORT;
6960 break;
6961 }
6962 }
6963
6964 static void
rtl8168_print_mac_version(struct rtl8168_private * tp)6965 rtl8168_print_mac_version(struct rtl8168_private *tp)
6966 {
6967 int i;
6968 for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) {
6969 if (tp->mcfg == rtl_chip_info[i].mcfg) {
6970 dprintk("Realtek PCIe GbE Family Controller mcfg = %04d\n",
6971 rtl_chip_info[i].mcfg);
6972 return;
6973 }
6974 }
6975
6976 dprintk("mac_version == Unknown\n");
6977 }
6978
rtl8168_calc_efuse_dummy_bit(u16 reg)6979 static u8 rtl8168_calc_efuse_dummy_bit(u16 reg)
6980 {
6981 int s,a,b;
6982 u8 dummyBitPos = 0;
6983
6984
6985 s=reg% 32;
6986 a=s % 16;
6987 b=s/16;
6988
6989 if (s/16) {
6990 dummyBitPos = (u8)(16-a);
6991 } else {
6992 dummyBitPos = (u8)a;
6993 }
6994
6995 return dummyBitPos;
6996 }
6997
rtl8168_decode_efuse_cmd(struct rtl8168_private * tp,u32 DwCmd)6998 static u32 rtl8168_decode_efuse_cmd(struct rtl8168_private *tp, u32 DwCmd)
6999 {
7000 u16 reg = (u16)((DwCmd & 0x00FE0000) >> 17);
7001 u32 DummyPos = rtl8168_calc_efuse_dummy_bit(reg);
7002 u32 DeCodeDwCmd = DwCmd;
7003 u32 Dw17BitData;
7004
7005
7006 if (tp->efuse_ver < 3) {
7007 DeCodeDwCmd = (DwCmd>>(DummyPos+1))<<DummyPos;
7008 if (DummyPos > 0) {
7009 DeCodeDwCmd |= ((DwCmd<<(32-DummyPos))>>(32-DummyPos));
7010 }
7011 } else {
7012 reg = (u16)((DwCmd & 0x007F0000) >> 16);
7013 DummyPos = rtl8168_calc_efuse_dummy_bit(reg);
7014 Dw17BitData = ((DwCmd & BIT_23) >> 23);
7015 Dw17BitData <<= 16;
7016 Dw17BitData |= (DwCmd & 0x0000FFFF);
7017 DeCodeDwCmd = (Dw17BitData>>(DummyPos+1))<<DummyPos;
7018 if (DummyPos > 0) {
7019 DeCodeDwCmd |= ((Dw17BitData<<(32-DummyPos))>>(32-DummyPos));
7020 }
7021 }
7022
7023 return DeCodeDwCmd;
7024 }
7025
rtl8168_efuse_read(struct rtl8168_private * tp,u16 reg)7026 static u8 rtl8168_efuse_read(struct rtl8168_private *tp, u16 reg)
7027 {
7028 u8 efuse_data = 0;
7029 u32 temp;
7030 int cnt;
7031
7032 if (tp->efuse_ver == EFUSE_NOT_SUPPORT)
7033 return EFUSE_READ_FAIL;
7034
7035 if (tp->efuse_ver == EFUSE_SUPPORT_V1) {
7036 temp = EFUSE_READ | ((reg & EFUSE_Reg_Mask) << EFUSE_Reg_Shift);
7037 RTL_W32(tp, EFUSEAR, temp);
7038
7039 cnt = 0;
7040 do {
7041 udelay(100);
7042 temp = RTL_R32(tp, EFUSEAR);
7043 cnt++;
7044 } while (!(temp & EFUSE_READ_OK) && (cnt < EFUSE_Check_Cnt));
7045
7046 if (cnt == EFUSE_Check_Cnt)
7047 efuse_data = EFUSE_READ_FAIL;
7048 else
7049 efuse_data = (u8)(RTL_R32(tp, EFUSEAR) & EFUSE_Data_Mask);
7050 } else if (tp->efuse_ver == EFUSE_SUPPORT_V2) {
7051 temp = (reg/2) & 0x03ff;
7052 temp <<= 17;
7053 temp |= EFUSE_READ;
7054 RTL_W32(tp, EFUSEAR, temp);
7055
7056 cnt = 0;
7057 do {
7058 udelay(100);
7059 temp = RTL_R32(tp, EFUSEAR);
7060 cnt++;
7061 } while (!(temp & EFUSE_READ_OK) && (cnt < EFUSE_Check_Cnt));
7062
7063 if (cnt == EFUSE_Check_Cnt) {
7064 efuse_data = EFUSE_READ_FAIL;
7065 } else {
7066 temp = RTL_R32(tp, EFUSEAR);
7067 temp = rtl8168_decode_efuse_cmd(tp, temp);
7068
7069 if (reg%2) {
7070 temp >>= 8;
7071 efuse_data = (u8)temp;
7072 } else {
7073 efuse_data = (u8)temp;
7074 }
7075 }
7076 } else if (tp->efuse_ver == EFUSE_SUPPORT_V3) {
7077 temp = (reg/2) & 0x03ff;
7078 temp <<= 16;
7079 temp |= EFUSE_READ_V3;
7080 RTL_W32(tp, EFUSEAR, temp);
7081
7082 cnt = 0;
7083 do {
7084 udelay(100);
7085 temp = RTL_R32(tp, EFUSEAR);
7086 cnt++;
7087 } while ((temp & BIT_31) && (cnt < EFUSE_Check_Cnt));
7088
7089 if (cnt == EFUSE_Check_Cnt) {
7090 efuse_data = EFUSE_READ_FAIL;
7091 } else {
7092 temp = RTL_R32(tp, EFUSEAR);
7093 temp = rtl8168_decode_efuse_cmd(tp, temp);
7094
7095 if (reg%2) {
7096 temp >>= 8;
7097 efuse_data = (u8)temp;
7098 } else {
7099 efuse_data = (u8)temp;
7100 }
7101 }
7102 }
7103
7104 udelay(20);
7105
7106 return efuse_data;
7107 }
7108
7109 static void
rtl8168_tally_counter_addr_fill(struct rtl8168_private * tp)7110 rtl8168_tally_counter_addr_fill(struct rtl8168_private *tp)
7111 {
7112 if (!tp->tally_paddr)
7113 return;
7114
7115 RTL_W32(tp, CounterAddrHigh, (u64)tp->tally_paddr >> 32);
7116 RTL_W32(tp, CounterAddrLow, (u64)tp->tally_paddr & (DMA_BIT_MASK(32)));
7117 }
7118
7119 static void
rtl8168_tally_counter_clear(struct rtl8168_private * tp)7120 rtl8168_tally_counter_clear(struct rtl8168_private *tp)
7121 {
7122 if (tp->mcfg == CFG_METHOD_1 || tp->mcfg == CFG_METHOD_2 ||
7123 tp->mcfg == CFG_METHOD_3 )
7124 return;
7125
7126 if (!tp->tally_paddr)
7127 return;
7128
7129 RTL_W32(tp, CounterAddrHigh, (u64)tp->tally_paddr >> 32);
7130 RTL_W32(tp, CounterAddrLow, ((u64)tp->tally_paddr & (DMA_BIT_MASK(32))) | CounterReset);
7131 }
7132
7133 static
7134 u16
rtl8168_get_phy_state(struct rtl8168_private * tp)7135 rtl8168_get_phy_state(struct rtl8168_private *tp)
7136 {
7137 u16 PhyState = 0xFF;
7138
7139 if (HW_SUPPORT_UPS_MODE(tp) == FALSE) goto exit;
7140
7141 switch (tp->HwSuppUpsVer) {
7142 case 1:
7143 PhyState = rtl8168_mdio_read_phy_ocp(tp, 0x0A42, 0x10);
7144 PhyState &= 0x7; //bit[2:0]
7145 break;
7146 }
7147
7148 exit:
7149 return PhyState;
7150 }
7151
7152 static
7153 bool
rtl8168_wait_phy_state_ready(struct rtl8168_private * tp,u16 PhyState,u32 MicroSecondTimeout)7154 rtl8168_wait_phy_state_ready(struct rtl8168_private *tp,
7155 u16 PhyState,
7156 u32 MicroSecondTimeout
7157 )
7158 {
7159 u16 TmpPhyState;
7160 u32 WaitCount;
7161 u32 i = 0;
7162 bool PhyStateReady = TRUE;
7163
7164 if (HW_SUPPORT_UPS_MODE(tp) == FALSE) goto exit;
7165
7166 WaitCount = MicroSecondTimeout / 1000;
7167 if (WaitCount == 0) WaitCount = 100;
7168
7169 do {
7170 TmpPhyState = rtl8168_get_phy_state(tp);
7171 mdelay(1);
7172 i++;
7173 } while ((i < WaitCount) && (TmpPhyState != PhyState));
7174
7175 PhyStateReady = (i == WaitCount && TmpPhyState != PhyState) ? FALSE : TRUE;
7176
7177 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
7178 WARN_ON_ONCE(i == WaitCount);
7179 #endif
7180
7181 exit:
7182 return PhyStateReady;
7183 }
7184
7185 static
7186 bool
rtl8168_test_phy_ocp(struct rtl8168_private * tp)7187 rtl8168_test_phy_ocp(struct rtl8168_private *tp)
7188 {
7189 bool RestorePhyOcpReg = FALSE;
7190
7191 if (tp->TestPhyOcpReg == FALSE) goto exit;
7192
7193 if (tp->HwSuppEsdVer == 2) {
7194 u16 PhyRegValue;
7195 u8 ResetPhyType = 0;
7196
7197 if (HW_PHY_STATUS_INI == rtl8168_get_phy_state(tp)) {
7198 ResetPhyType = 1;
7199 } else {
7200 rtl8168_mdio_write(tp, 0x1F, 0x0C40);
7201 PhyRegValue = rtl8168_mdio_read(tp, 0x12);
7202 rtl8168_mdio_write(tp, 0x1F, 0x0000);
7203 if ((PhyRegValue & 0x03) != 0x00) {
7204 ResetPhyType = 2;
7205 }
7206 }
7207
7208 if (ResetPhyType > 0) {
7209 u32 WaitCnt;
7210 struct net_device *dev = tp->dev;
7211
7212 printk(KERN_ERR "%s: test_phy_ocp ResetPhyType = 0x%02x\n.\n", dev->name, ResetPhyType);
7213
7214 rtl8168_mdio_write(tp, 0x1F, 0x0C41);
7215 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_0);
7216 rtl8168_mdio_write(tp, 0x1F, 0x0000);
7217 mdelay(24); //24ms
7218
7219 rtl8168_mdio_write(tp, 0x1F, 0x0C40);
7220 PhyRegValue = rtl8168_mdio_read(tp, 0x12);
7221 if ((PhyRegValue & 0x03) != 0x00) {
7222 WaitCnt = 0;
7223 while ((PhyRegValue & 0x03) != 0x00 && WaitCnt < 5) {
7224 rtl8168_mdio_write(tp, 0x1F, 0x0C40);
7225 rtl8168_set_eth_phy_bit(tp, 0x11, (BIT_15 | BIT_14));
7226 rtl8168_clear_eth_phy_bit(tp, 0x11, (BIT_15 | BIT_14));
7227 mdelay(100);
7228 rtl8168_mdio_write(tp, 0x1F, 0x0C40);
7229 PhyRegValue = rtl8168_mdio_read(tp, 0x12);
7230 WaitCnt++;
7231 }
7232 }
7233
7234 rtl8168_mdio_write(tp, 0x1F, 0x0000);
7235
7236 rtl8168_mdio_write(tp, 0x1F, 0x0A46);
7237 rtl8168_mdio_write(tp, 0x10, tp->BackupPhyFuseDout_15_0);
7238 rtl8168_mdio_write(tp, 0x12, tp->BackupPhyFuseDout_47_32);
7239 rtl8168_mdio_write(tp, 0x13, tp->BackupPhyFuseDout_63_48);
7240 rtl8168_mdio_write(tp, 0x1F, 0x0000);
7241
7242 rtl8168_wait_phy_state_ready(tp, HW_PHY_STATUS_INI, 5000000);
7243 rtl8168_mdio_write(tp, 0x1F, 0x0A46);
7244 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_0);
7245 rtl8168_mdio_write(tp, 0x1F, 0x0000);
7246 rtl8168_wait_phy_state_ready(tp, HW_PHY_STATUS_LAN_ON, 500000);
7247
7248 tp->HwHasWrRamCodeToMicroP = FALSE;
7249
7250 RestorePhyOcpReg = TRUE;
7251 }
7252
7253 rtl8168_mdio_write(tp, 0x1F, 0x0000);
7254 }
7255
7256 exit:
7257 return RestorePhyOcpReg;
7258 }
7259
7260 static int
rtl8168_is_ups_resume(struct net_device * dev)7261 rtl8168_is_ups_resume(struct net_device *dev)
7262 {
7263 struct rtl8168_private *tp = netdev_priv(dev);
7264
7265 return (rtl8168_mac_ocp_read(tp, 0xD408) & BIT_0);
7266 }
7267
7268 static void
rtl8168_clear_ups_resume_bit(struct net_device * dev)7269 rtl8168_clear_ups_resume_bit(struct net_device *dev)
7270 {
7271 struct rtl8168_private *tp = netdev_priv(dev);
7272
7273 rtl8168_mac_ocp_write(tp, 0xD408, rtl8168_mac_ocp_read(tp, 0xD408) & ~(BIT_0));
7274 }
7275
7276 static void
rtl8168_wait_phy_ups_resume(struct net_device * dev,u16 PhyState)7277 rtl8168_wait_phy_ups_resume(struct net_device *dev, u16 PhyState)
7278 {
7279 struct rtl8168_private *tp = netdev_priv(dev);
7280 u16 TmpPhyState;
7281 int i = 0;
7282
7283 do {
7284 TmpPhyState = rtl8168_mdio_read_phy_ocp(tp, 0x0A42, 0x10);
7285 TmpPhyState &= 0x7;
7286 mdelay(1);
7287 i++;
7288 } while ((i < 100) && (TmpPhyState != PhyState));
7289
7290 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
7291 WARN_ON_ONCE(i == 100);
7292 #endif
7293 }
7294
7295 void
rtl8168_enable_now_is_oob(struct rtl8168_private * tp)7296 rtl8168_enable_now_is_oob(struct rtl8168_private *tp)
7297 {
7298 if ( tp->HwSuppNowIsOobVer == 1 ) {
7299 RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) | Now_is_oob);
7300 }
7301 }
7302
7303 void
rtl8168_disable_now_is_oob(struct rtl8168_private * tp)7304 rtl8168_disable_now_is_oob(struct rtl8168_private *tp)
7305 {
7306 if ( tp->HwSuppNowIsOobVer == 1 ) {
7307 RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) & ~Now_is_oob);
7308 }
7309 }
7310
7311 static void
rtl8168_switch_to_sgmii_mode(struct rtl8168_private * tp)7312 rtl8168_switch_to_sgmii_mode(
7313 struct rtl8168_private *tp
7314 )
7315 {
7316 if (FALSE == HW_SUPP_SERDES_PHY(tp)) return;
7317
7318 switch (tp->HwSuppSerDesPhyVer) {
7319 case 1:
7320 rtl8168_mac_ocp_write(tp, 0xEB00, 0x2);
7321 rtl8168_set_mcu_ocp_bit(tp, 0xEB16, BIT_1);
7322 break;
7323 }
7324 }
7325
7326 static void
rtl8168_exit_oob(struct net_device * dev)7327 rtl8168_exit_oob(struct net_device *dev)
7328 {
7329 struct rtl8168_private *tp = netdev_priv(dev);
7330 u16 data16;
7331
7332 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(AcceptErr | AcceptRunt | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys));
7333
7334 if (HW_SUPP_SERDES_PHY(tp)) {
7335 if (tp->HwSuppSerDesPhyVer == 1) {
7336 rtl8168_switch_to_sgmii_mode(tp);
7337 }
7338 }
7339
7340 if (HW_DASH_SUPPORT_DASH(tp)) {
7341 rtl8168_driver_start(tp);
7342 rtl8168_dash2_disable_txrx(dev);
7343 #ifdef ENABLE_DASH_SUPPORT
7344 DashHwInit(dev);
7345 #endif
7346 }
7347
7348 //Disable realwow function
7349 switch (tp->mcfg) {
7350 case CFG_METHOD_18:
7351 case CFG_METHOD_19:
7352 RTL_W32(tp, MACOCP, 0xE5A90000);
7353 RTL_W32(tp, MACOCP, 0xF2100010);
7354 break;
7355 case CFG_METHOD_20:
7356 RTL_W32(tp, MACOCP, 0xE5A90000);
7357 RTL_W32(tp, MACOCP, 0xE4640000);
7358 RTL_W32(tp, MACOCP, 0xF2100010);
7359 break;
7360 case CFG_METHOD_21:
7361 case CFG_METHOD_22:
7362 RTL_W32(tp, MACOCP, 0x605E0000);
7363 RTL_W32(tp, MACOCP, (0xE05E << 16) | (RTL_R32(tp, MACOCP) & 0xFFFE));
7364 RTL_W32(tp, MACOCP, 0xE9720000);
7365 RTL_W32(tp, MACOCP, 0xF2140010);
7366 break;
7367 case CFG_METHOD_26:
7368 RTL_W32(tp, MACOCP, 0xE05E00FF);
7369 RTL_W32(tp, MACOCP, 0xE9720000);
7370 rtl8168_mac_ocp_write(tp, 0xE428, 0x0010);
7371 break;
7372 }
7373
7374 #ifdef ENABLE_REALWOW_SUPPORT
7375 rtl8168_realwow_hw_init(dev);
7376 #else
7377 switch (tp->mcfg) {
7378 case CFG_METHOD_21:
7379 case CFG_METHOD_22:
7380 rtl8168_eri_write(tp, 0x174, 2, 0x0000, ERIAR_ExGMAC);
7381 rtl8168_mac_ocp_write(tp, 0xE428, 0x0010);
7382 break;
7383 case CFG_METHOD_24:
7384 case CFG_METHOD_25:
7385 case CFG_METHOD_26:
7386 case CFG_METHOD_28:
7387 case CFG_METHOD_31:
7388 case CFG_METHOD_32:
7389 case CFG_METHOD_33:
7390 rtl8168_eri_write(tp, 0x174, 2, 0x00FF, ERIAR_ExGMAC);
7391 rtl8168_mac_ocp_write(tp, 0xE428, 0x0010);
7392 break;
7393 case CFG_METHOD_29:
7394 case CFG_METHOD_30: {
7395 u32 csi_tmp;
7396 csi_tmp = rtl8168_eri_read(tp, 0x174, 2, ERIAR_ExGMAC);
7397 csi_tmp &= ~(BIT_8);
7398 csi_tmp |= (BIT_15);
7399 rtl8168_eri_write(tp, 0x174, 2, csi_tmp, ERIAR_ExGMAC);
7400 rtl8168_mac_ocp_write(tp, 0xE428, 0x0010);
7401 }
7402 break;
7403 }
7404 #endif //ENABLE_REALWOW_SUPPORT
7405
7406 rtl8168_nic_reset(dev);
7407
7408 switch (tp->mcfg) {
7409 case CFG_METHOD_20:
7410 rtl8168_wait_ll_share_fifo_ready(dev);
7411
7412 data16 = rtl8168_mac_ocp_read(tp, 0xD4DE) | BIT_15;
7413 rtl8168_mac_ocp_write(tp, 0xD4DE, data16);
7414
7415 rtl8168_wait_ll_share_fifo_ready(dev);
7416 break;
7417 case CFG_METHOD_21:
7418 case CFG_METHOD_22:
7419 case CFG_METHOD_23:
7420 case CFG_METHOD_24:
7421 case CFG_METHOD_25:
7422 case CFG_METHOD_26:
7423 case CFG_METHOD_27:
7424 case CFG_METHOD_28:
7425 case CFG_METHOD_29:
7426 case CFG_METHOD_30:
7427 case CFG_METHOD_31:
7428 case CFG_METHOD_32:
7429 case CFG_METHOD_33:
7430 rtl8168_disable_now_is_oob(tp);
7431
7432 data16 = rtl8168_mac_ocp_read(tp, 0xE8DE) & ~BIT_14;
7433 rtl8168_mac_ocp_write(tp, 0xE8DE, data16);
7434 rtl8168_wait_ll_share_fifo_ready(dev);
7435
7436 data16 = rtl8168_mac_ocp_read(tp, 0xE8DE) | BIT_15;
7437 rtl8168_mac_ocp_write(tp, 0xE8DE, data16);
7438
7439 rtl8168_wait_ll_share_fifo_ready(dev);
7440 break;
7441 }
7442
7443 //wait ups resume (phy state 2)
7444 if (HW_SUPPORT_UPS_MODE(tp))
7445 if (rtl8168_is_ups_resume(dev)) {
7446 rtl8168_wait_phy_ups_resume(dev, HW_PHY_STATUS_EXT_INI);
7447 rtl8168_clear_ups_resume_bit(dev);
7448 }
7449
7450 #ifdef ENABLE_FIBER_SUPPORT
7451 if (HW_FIBER_MODE_ENABLED(tp))
7452 rtl8168_hw_init_fiber_nic(dev);
7453 #endif //ENABLE_FIBER_SUPPORT
7454 }
7455
7456 void
rtl8168_hw_disable_mac_mcu_bps(struct net_device * dev)7457 rtl8168_hw_disable_mac_mcu_bps(struct net_device *dev)
7458 {
7459 struct rtl8168_private *tp = netdev_priv(dev);
7460
7461 if (tp->HwSuppAspmClkIntrLock) {
7462 rtl8168_enable_cfg9346_write(tp);
7463 rtl8168_hw_aspm_clkreq_enable(tp, false);
7464 rtl8168_disable_cfg9346_write(tp);
7465 }
7466
7467 switch (tp->mcfg) {
7468 case CFG_METHOD_29:
7469 case CFG_METHOD_30:
7470 case CFG_METHOD_31:
7471 case CFG_METHOD_32:
7472 case CFG_METHOD_33:
7473 rtl8168_mac_ocp_write(tp, 0xFC38, 0x0000);
7474 break;
7475 }
7476
7477 switch (tp->mcfg) {
7478 case CFG_METHOD_21:
7479 case CFG_METHOD_22:
7480 case CFG_METHOD_23:
7481 case CFG_METHOD_24:
7482 case CFG_METHOD_25:
7483 case CFG_METHOD_26:
7484 case CFG_METHOD_27:
7485 case CFG_METHOD_28:
7486 case CFG_METHOD_29:
7487 case CFG_METHOD_30:
7488 case CFG_METHOD_31:
7489 case CFG_METHOD_32:
7490 case CFG_METHOD_33:
7491 rtl8168_mac_ocp_write(tp, 0xFC28, 0x0000);
7492 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0000);
7493 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0000);
7494 rtl8168_mac_ocp_write(tp, 0xFC2E, 0x0000);
7495 rtl8168_mac_ocp_write(tp, 0xFC30, 0x0000);
7496 rtl8168_mac_ocp_write(tp, 0xFC32, 0x0000);
7497 rtl8168_mac_ocp_write(tp, 0xFC34, 0x0000);
7498 rtl8168_mac_ocp_write(tp, 0xFC36, 0x0000);
7499 mdelay(3);
7500 rtl8168_mac_ocp_write(tp, 0xFC26, 0x0000);
7501 break;
7502 }
7503 }
7504
7505 #ifndef ENABLE_USE_FIRMWARE_FILE
7506 static void
rtl8168_set_mac_mcu_8168g_1(struct net_device * dev)7507 rtl8168_set_mac_mcu_8168g_1(struct net_device *dev)
7508 {
7509 struct rtl8168_private *tp = netdev_priv(dev);
7510
7511 rtl8168_mac_ocp_write(tp, 0xE43C, 0x0000);
7512 rtl8168_mac_ocp_write(tp, 0xE43E, 0x0000);
7513
7514 rtl8168_mac_ocp_write(tp, 0xE434, 0x0004);
7515 rtl8168_mac_ocp_write(tp, 0xE43C, 0x0004);
7516
7517 rtl8168_hw_disable_mac_mcu_bps(dev);
7518
7519 rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
7520 rtl8168_mac_ocp_write( tp, 0xF802, 0xE01B );
7521 rtl8168_mac_ocp_write( tp, 0xF804, 0xE022 );
7522 rtl8168_mac_ocp_write( tp, 0xF806, 0xE094 );
7523 rtl8168_mac_ocp_write( tp, 0xF808, 0xE097 );
7524 rtl8168_mac_ocp_write( tp, 0xF80A, 0xE09A );
7525 rtl8168_mac_ocp_write( tp, 0xF80C, 0xE0B3 );
7526 rtl8168_mac_ocp_write( tp, 0xF80E, 0xE0BA );
7527 rtl8168_mac_ocp_write( tp, 0xF810, 0x49D2 );
7528 rtl8168_mac_ocp_write( tp, 0xF812, 0xF10D );
7529 rtl8168_mac_ocp_write( tp, 0xF814, 0x766C );
7530 rtl8168_mac_ocp_write( tp, 0xF816, 0x49E2 );
7531 rtl8168_mac_ocp_write( tp, 0xF818, 0xF00A );
7532 rtl8168_mac_ocp_write( tp, 0xF81A, 0x1EC0 );
7533 rtl8168_mac_ocp_write( tp, 0xF81C, 0x8EE1 );
7534 rtl8168_mac_ocp_write( tp, 0xF81E, 0xC60A );
7535 rtl8168_mac_ocp_write( tp, 0xF820, 0x77C0 );
7536 rtl8168_mac_ocp_write( tp, 0xF822, 0x4870 );
7537 rtl8168_mac_ocp_write( tp, 0xF824, 0x9FC0 );
7538 rtl8168_mac_ocp_write( tp, 0xF826, 0x1EA0 );
7539 rtl8168_mac_ocp_write( tp, 0xF828, 0xC707 );
7540 rtl8168_mac_ocp_write( tp, 0xF82A, 0x8EE1 );
7541 rtl8168_mac_ocp_write( tp, 0xF82C, 0x9D6C );
7542 rtl8168_mac_ocp_write( tp, 0xF82E, 0xC603 );
7543 rtl8168_mac_ocp_write( tp, 0xF830, 0xBE00 );
7544 rtl8168_mac_ocp_write( tp, 0xF832, 0xB416 );
7545 rtl8168_mac_ocp_write( tp, 0xF834, 0x0076 );
7546 rtl8168_mac_ocp_write( tp, 0xF836, 0xE86C );
7547 rtl8168_mac_ocp_write( tp, 0xF838, 0xC406 );
7548 rtl8168_mac_ocp_write( tp, 0xF83A, 0x7580 );
7549 rtl8168_mac_ocp_write( tp, 0xF83C, 0x4852 );
7550 rtl8168_mac_ocp_write( tp, 0xF83E, 0x8D80 );
7551 rtl8168_mac_ocp_write( tp, 0xF840, 0xC403 );
7552 rtl8168_mac_ocp_write( tp, 0xF842, 0xBC00 );
7553 rtl8168_mac_ocp_write( tp, 0xF844, 0xD3E0 );
7554 rtl8168_mac_ocp_write( tp, 0xF846, 0x02C8 );
7555 rtl8168_mac_ocp_write( tp, 0xF848, 0x8918 );
7556 rtl8168_mac_ocp_write( tp, 0xF84A, 0xE815 );
7557 rtl8168_mac_ocp_write( tp, 0xF84C, 0x1100 );
7558 rtl8168_mac_ocp_write( tp, 0xF84E, 0xF011 );
7559 rtl8168_mac_ocp_write( tp, 0xF850, 0xE812 );
7560 rtl8168_mac_ocp_write( tp, 0xF852, 0x4990 );
7561 rtl8168_mac_ocp_write( tp, 0xF854, 0xF002 );
7562 rtl8168_mac_ocp_write( tp, 0xF856, 0xE817 );
7563 rtl8168_mac_ocp_write( tp, 0xF858, 0xE80E );
7564 rtl8168_mac_ocp_write( tp, 0xF85A, 0x4992 );
7565 rtl8168_mac_ocp_write( tp, 0xF85C, 0xF002 );
7566 rtl8168_mac_ocp_write( tp, 0xF85E, 0xE80E );
7567 rtl8168_mac_ocp_write( tp, 0xF860, 0xE80A );
7568 rtl8168_mac_ocp_write( tp, 0xF862, 0x4993 );
7569 rtl8168_mac_ocp_write( tp, 0xF864, 0xF002 );
7570 rtl8168_mac_ocp_write( tp, 0xF866, 0xE818 );
7571 rtl8168_mac_ocp_write( tp, 0xF868, 0xE806 );
7572 rtl8168_mac_ocp_write( tp, 0xF86A, 0x4991 );
7573 rtl8168_mac_ocp_write( tp, 0xF86C, 0xF002 );
7574 rtl8168_mac_ocp_write( tp, 0xF86E, 0xE838 );
7575 rtl8168_mac_ocp_write( tp, 0xF870, 0xC25E );
7576 rtl8168_mac_ocp_write( tp, 0xF872, 0xBA00 );
7577 rtl8168_mac_ocp_write( tp, 0xF874, 0xC056 );
7578 rtl8168_mac_ocp_write( tp, 0xF876, 0x7100 );
7579 rtl8168_mac_ocp_write( tp, 0xF878, 0xFF80 );
7580 rtl8168_mac_ocp_write( tp, 0xF87A, 0x7100 );
7581 rtl8168_mac_ocp_write( tp, 0xF87C, 0x4892 );
7582 rtl8168_mac_ocp_write( tp, 0xF87E, 0x4813 );
7583 rtl8168_mac_ocp_write( tp, 0xF880, 0x8900 );
7584 rtl8168_mac_ocp_write( tp, 0xF882, 0xE00A );
7585 rtl8168_mac_ocp_write( tp, 0xF884, 0x7100 );
7586 rtl8168_mac_ocp_write( tp, 0xF886, 0x4890 );
7587 rtl8168_mac_ocp_write( tp, 0xF888, 0x4813 );
7588 rtl8168_mac_ocp_write( tp, 0xF88A, 0x8900 );
7589 rtl8168_mac_ocp_write( tp, 0xF88C, 0xC74B );
7590 rtl8168_mac_ocp_write( tp, 0xF88E, 0x74F8 );
7591 rtl8168_mac_ocp_write( tp, 0xF890, 0x48C2 );
7592 rtl8168_mac_ocp_write( tp, 0xF892, 0x4841 );
7593 rtl8168_mac_ocp_write( tp, 0xF894, 0x8CF8 );
7594 rtl8168_mac_ocp_write( tp, 0xF896, 0xC746 );
7595 rtl8168_mac_ocp_write( tp, 0xF898, 0x74FC );
7596 rtl8168_mac_ocp_write( tp, 0xF89A, 0x49C0 );
7597 rtl8168_mac_ocp_write( tp, 0xF89C, 0xF120 );
7598 rtl8168_mac_ocp_write( tp, 0xF89E, 0x49C1 );
7599 rtl8168_mac_ocp_write( tp, 0xF8A0, 0xF11E );
7600 rtl8168_mac_ocp_write( tp, 0xF8A2, 0x74F8 );
7601 rtl8168_mac_ocp_write( tp, 0xF8A4, 0x49C0 );
7602 rtl8168_mac_ocp_write( tp, 0xF8A6, 0xF01B );
7603 rtl8168_mac_ocp_write( tp, 0xF8A8, 0x49C6 );
7604 rtl8168_mac_ocp_write( tp, 0xF8AA, 0xF119 );
7605 rtl8168_mac_ocp_write( tp, 0xF8AC, 0x74F8 );
7606 rtl8168_mac_ocp_write( tp, 0xF8AE, 0x49C4 );
7607 rtl8168_mac_ocp_write( tp, 0xF8B0, 0xF013 );
7608 rtl8168_mac_ocp_write( tp, 0xF8B2, 0xC536 );
7609 rtl8168_mac_ocp_write( tp, 0xF8B4, 0x74B0 );
7610 rtl8168_mac_ocp_write( tp, 0xF8B6, 0x49C1 );
7611 rtl8168_mac_ocp_write( tp, 0xF8B8, 0xF1FD );
7612 rtl8168_mac_ocp_write( tp, 0xF8BA, 0xC537 );
7613 rtl8168_mac_ocp_write( tp, 0xF8BC, 0xC434 );
7614 rtl8168_mac_ocp_write( tp, 0xF8BE, 0x9CA0 );
7615 rtl8168_mac_ocp_write( tp, 0xF8C0, 0xC435 );
7616 rtl8168_mac_ocp_write( tp, 0xF8C2, 0x1C13 );
7617 rtl8168_mac_ocp_write( tp, 0xF8C4, 0x484F );
7618 rtl8168_mac_ocp_write( tp, 0xF8C6, 0x9CA2 );
7619 rtl8168_mac_ocp_write( tp, 0xF8C8, 0xC52B );
7620 rtl8168_mac_ocp_write( tp, 0xF8CA, 0x74B0 );
7621 rtl8168_mac_ocp_write( tp, 0xF8CC, 0x49C1 );
7622 rtl8168_mac_ocp_write( tp, 0xF8CE, 0xF1FD );
7623 rtl8168_mac_ocp_write( tp, 0xF8D0, 0x74F8 );
7624 rtl8168_mac_ocp_write( tp, 0xF8D2, 0x48C4 );
7625 rtl8168_mac_ocp_write( tp, 0xF8D4, 0x8CF8 );
7626 rtl8168_mac_ocp_write( tp, 0xF8D6, 0x7100 );
7627 rtl8168_mac_ocp_write( tp, 0xF8D8, 0x4893 );
7628 rtl8168_mac_ocp_write( tp, 0xF8DA, 0x8900 );
7629 rtl8168_mac_ocp_write( tp, 0xF8DC, 0xFF80 );
7630 rtl8168_mac_ocp_write( tp, 0xF8DE, 0xC520 );
7631 rtl8168_mac_ocp_write( tp, 0xF8E0, 0x74B0 );
7632 rtl8168_mac_ocp_write( tp, 0xF8E2, 0x49C1 );
7633 rtl8168_mac_ocp_write( tp, 0xF8E4, 0xF11C );
7634 rtl8168_mac_ocp_write( tp, 0xF8E6, 0xC71E );
7635 rtl8168_mac_ocp_write( tp, 0xF8E8, 0x74FC );
7636 rtl8168_mac_ocp_write( tp, 0xF8EA, 0x49C1 );
7637 rtl8168_mac_ocp_write( tp, 0xF8EC, 0xF118 );
7638 rtl8168_mac_ocp_write( tp, 0xF8EE, 0x49C0 );
7639 rtl8168_mac_ocp_write( tp, 0xF8F0, 0xF116 );
7640 rtl8168_mac_ocp_write( tp, 0xF8F2, 0x74F8 );
7641 rtl8168_mac_ocp_write( tp, 0xF8F4, 0x49C0 );
7642 rtl8168_mac_ocp_write( tp, 0xF8F6, 0xF013 );
7643 rtl8168_mac_ocp_write( tp, 0xF8F8, 0x48C3 );
7644 rtl8168_mac_ocp_write( tp, 0xF8FA, 0x8CF8 );
7645 rtl8168_mac_ocp_write( tp, 0xF8FC, 0xC516 );
7646 rtl8168_mac_ocp_write( tp, 0xF8FE, 0x74A2 );
7647 rtl8168_mac_ocp_write( tp, 0xF900, 0x49CE );
7648 rtl8168_mac_ocp_write( tp, 0xF902, 0xF1FE );
7649 rtl8168_mac_ocp_write( tp, 0xF904, 0xC411 );
7650 rtl8168_mac_ocp_write( tp, 0xF906, 0x9CA0 );
7651 rtl8168_mac_ocp_write( tp, 0xF908, 0xC411 );
7652 rtl8168_mac_ocp_write( tp, 0xF90A, 0x1C13 );
7653 rtl8168_mac_ocp_write( tp, 0xF90C, 0x484F );
7654 rtl8168_mac_ocp_write( tp, 0xF90E, 0x9CA2 );
7655 rtl8168_mac_ocp_write( tp, 0xF910, 0x74A2 );
7656 rtl8168_mac_ocp_write( tp, 0xF912, 0x49CF );
7657 rtl8168_mac_ocp_write( tp, 0xF914, 0xF1FE );
7658 rtl8168_mac_ocp_write( tp, 0xF916, 0x7100 );
7659 rtl8168_mac_ocp_write( tp, 0xF918, 0x4891 );
7660 rtl8168_mac_ocp_write( tp, 0xF91A, 0x8900 );
7661 rtl8168_mac_ocp_write( tp, 0xF91C, 0xFF80 );
7662 rtl8168_mac_ocp_write( tp, 0xF91E, 0xE400 );
7663 rtl8168_mac_ocp_write( tp, 0xF920, 0xD3E0 );
7664 rtl8168_mac_ocp_write( tp, 0xF922, 0xE000 );
7665 rtl8168_mac_ocp_write( tp, 0xF924, 0x0481 );
7666 rtl8168_mac_ocp_write( tp, 0xF926, 0x0C81 );
7667 rtl8168_mac_ocp_write( tp, 0xF928, 0xDE20 );
7668 rtl8168_mac_ocp_write( tp, 0xF92A, 0x0000 );
7669 rtl8168_mac_ocp_write( tp, 0xF92C, 0x0992 );
7670 rtl8168_mac_ocp_write( tp, 0xF92E, 0x1B76 );
7671 rtl8168_mac_ocp_write( tp, 0xF930, 0xC602 );
7672 rtl8168_mac_ocp_write( tp, 0xF932, 0xBE00 );
7673 rtl8168_mac_ocp_write( tp, 0xF934, 0x059C );
7674 rtl8168_mac_ocp_write( tp, 0xF936, 0x1B76 );
7675 rtl8168_mac_ocp_write( tp, 0xF938, 0xC602 );
7676 rtl8168_mac_ocp_write( tp, 0xF93A, 0xBE00 );
7677 rtl8168_mac_ocp_write( tp, 0xF93C, 0x065A );
7678 rtl8168_mac_ocp_write( tp, 0xF93E, 0xB400 );
7679 rtl8168_mac_ocp_write( tp, 0xF940, 0x18DE );
7680 rtl8168_mac_ocp_write( tp, 0xF942, 0x2008 );
7681 rtl8168_mac_ocp_write( tp, 0xF944, 0x4001 );
7682 rtl8168_mac_ocp_write( tp, 0xF946, 0xF10F );
7683 rtl8168_mac_ocp_write( tp, 0xF948, 0x7342 );
7684 rtl8168_mac_ocp_write( tp, 0xF94A, 0x1880 );
7685 rtl8168_mac_ocp_write( tp, 0xF94C, 0x2008 );
7686 rtl8168_mac_ocp_write( tp, 0xF94E, 0x0009 );
7687 rtl8168_mac_ocp_write( tp, 0xF950, 0x4018 );
7688 rtl8168_mac_ocp_write( tp, 0xF952, 0xF109 );
7689 rtl8168_mac_ocp_write( tp, 0xF954, 0x7340 );
7690 rtl8168_mac_ocp_write( tp, 0xF956, 0x25BC );
7691 rtl8168_mac_ocp_write( tp, 0xF958, 0x130F );
7692 rtl8168_mac_ocp_write( tp, 0xF95A, 0xF105 );
7693 rtl8168_mac_ocp_write( tp, 0xF95C, 0xC00A );
7694 rtl8168_mac_ocp_write( tp, 0xF95E, 0x7300 );
7695 rtl8168_mac_ocp_write( tp, 0xF960, 0x4831 );
7696 rtl8168_mac_ocp_write( tp, 0xF962, 0x9B00 );
7697 rtl8168_mac_ocp_write( tp, 0xF964, 0xB000 );
7698 rtl8168_mac_ocp_write( tp, 0xF966, 0x7340 );
7699 rtl8168_mac_ocp_write( tp, 0xF968, 0x8320 );
7700 rtl8168_mac_ocp_write( tp, 0xF96A, 0xC302 );
7701 rtl8168_mac_ocp_write( tp, 0xF96C, 0xBB00 );
7702 rtl8168_mac_ocp_write( tp, 0xF96E, 0x0C12 );
7703 rtl8168_mac_ocp_write( tp, 0xF970, 0xE860 );
7704 rtl8168_mac_ocp_write( tp, 0xF972, 0xC406 );
7705 rtl8168_mac_ocp_write( tp, 0xF974, 0x7580 );
7706 rtl8168_mac_ocp_write( tp, 0xF976, 0x4851 );
7707 rtl8168_mac_ocp_write( tp, 0xF978, 0x8D80 );
7708 rtl8168_mac_ocp_write( tp, 0xF97A, 0xC403 );
7709 rtl8168_mac_ocp_write( tp, 0xF97C, 0xBC00 );
7710 rtl8168_mac_ocp_write( tp, 0xF97E, 0xD3E0 );
7711 rtl8168_mac_ocp_write( tp, 0xF980, 0x02C8 );
7712 rtl8168_mac_ocp_write( tp, 0xF982, 0xC406 );
7713 rtl8168_mac_ocp_write( tp, 0xF984, 0x7580 );
7714 rtl8168_mac_ocp_write( tp, 0xF986, 0x4850 );
7715 rtl8168_mac_ocp_write( tp, 0xF988, 0x8D80 );
7716 rtl8168_mac_ocp_write( tp, 0xF98A, 0xC403 );
7717 rtl8168_mac_ocp_write( tp, 0xF98C, 0xBC00 );
7718 rtl8168_mac_ocp_write( tp, 0xF98E, 0xD3E0 );
7719 rtl8168_mac_ocp_write( tp, 0xF990, 0x0298 );
7720
7721 rtl8168_mac_ocp_write( tp, 0xDE30, 0x0080 );
7722
7723 rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
7724
7725 rtl8168_mac_ocp_write( tp, 0xFC28, 0x0075 );
7726 rtl8168_mac_ocp_write( tp, 0xFC2A, 0x02B1 );
7727 rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0991 );
7728 rtl8168_mac_ocp_write( tp, 0xFC2E, 0x059B );
7729 rtl8168_mac_ocp_write( tp, 0xFC30, 0x0659 );
7730 rtl8168_mac_ocp_write( tp, 0xFC32, 0x0000 );
7731 rtl8168_mac_ocp_write( tp, 0xFC34, 0x02C7 );
7732 rtl8168_mac_ocp_write( tp, 0xFC36, 0x0279 );
7733 }
7734
7735 static void
rtl8168_set_mac_mcu_8168gu_1(struct net_device * dev)7736 rtl8168_set_mac_mcu_8168gu_1(struct net_device *dev)
7737 {
7738 struct rtl8168_private *tp = netdev_priv(dev);
7739
7740 rtl8168_hw_disable_mac_mcu_bps(dev);
7741
7742 rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
7743 rtl8168_mac_ocp_write( tp, 0xF802, 0xE011 );
7744 rtl8168_mac_ocp_write( tp, 0xF804, 0xE015 );
7745 rtl8168_mac_ocp_write( tp, 0xF806, 0xE018 );
7746 rtl8168_mac_ocp_write( tp, 0xF808, 0xE01B );
7747 rtl8168_mac_ocp_write( tp, 0xF80A, 0xE027 );
7748 rtl8168_mac_ocp_write( tp, 0xF80C, 0xE043 );
7749 rtl8168_mac_ocp_write( tp, 0xF80E, 0xE065 );
7750 rtl8168_mac_ocp_write( tp, 0xF810, 0x49E2 );
7751 rtl8168_mac_ocp_write( tp, 0xF812, 0xF005 );
7752 rtl8168_mac_ocp_write( tp, 0xF814, 0x49EA );
7753 rtl8168_mac_ocp_write( tp, 0xF816, 0xF003 );
7754 rtl8168_mac_ocp_write( tp, 0xF818, 0xC404 );
7755 rtl8168_mac_ocp_write( tp, 0xF81A, 0xBC00 );
7756 rtl8168_mac_ocp_write( tp, 0xF81C, 0xC403 );
7757 rtl8168_mac_ocp_write( tp, 0xF81E, 0xBC00 );
7758 rtl8168_mac_ocp_write( tp, 0xF820, 0x0496 );
7759 rtl8168_mac_ocp_write( tp, 0xF822, 0x051A );
7760 rtl8168_mac_ocp_write( tp, 0xF824, 0x1D01 );
7761 rtl8168_mac_ocp_write( tp, 0xF826, 0x8DE8 );
7762 rtl8168_mac_ocp_write( tp, 0xF828, 0xC602 );
7763 rtl8168_mac_ocp_write( tp, 0xF82A, 0xBE00 );
7764 rtl8168_mac_ocp_write( tp, 0xF82C, 0x0206 );
7765 rtl8168_mac_ocp_write( tp, 0xF82E, 0x1B76 );
7766 rtl8168_mac_ocp_write( tp, 0xF830, 0xC202 );
7767 rtl8168_mac_ocp_write( tp, 0xF832, 0xBA00 );
7768 rtl8168_mac_ocp_write( tp, 0xF834, 0x058A );
7769 rtl8168_mac_ocp_write( tp, 0xF836, 0x1B76 );
7770 rtl8168_mac_ocp_write( tp, 0xF838, 0xC602 );
7771 rtl8168_mac_ocp_write( tp, 0xF83A, 0xBE00 );
7772 rtl8168_mac_ocp_write( tp, 0xF83C, 0x0648 );
7773 rtl8168_mac_ocp_write( tp, 0xF83E, 0x74E6 );
7774 rtl8168_mac_ocp_write( tp, 0xF840, 0x1B78 );
7775 rtl8168_mac_ocp_write( tp, 0xF842, 0x46DC );
7776 rtl8168_mac_ocp_write( tp, 0xF844, 0x1300 );
7777 rtl8168_mac_ocp_write( tp, 0xF846, 0xF005 );
7778 rtl8168_mac_ocp_write( tp, 0xF848, 0x74F8 );
7779 rtl8168_mac_ocp_write( tp, 0xF84A, 0x48C3 );
7780 rtl8168_mac_ocp_write( tp, 0xF84C, 0x48C4 );
7781 rtl8168_mac_ocp_write( tp, 0xF84E, 0x8CF8 );
7782 rtl8168_mac_ocp_write( tp, 0xF850, 0x64E7 );
7783 rtl8168_mac_ocp_write( tp, 0xF852, 0xC302 );
7784 rtl8168_mac_ocp_write( tp, 0xF854, 0xBB00 );
7785 rtl8168_mac_ocp_write( tp, 0xF856, 0x068E );
7786 rtl8168_mac_ocp_write( tp, 0xF858, 0x74E4 );
7787 rtl8168_mac_ocp_write( tp, 0xF85A, 0x49C5 );
7788 rtl8168_mac_ocp_write( tp, 0xF85C, 0xF106 );
7789 rtl8168_mac_ocp_write( tp, 0xF85E, 0x49C6 );
7790 rtl8168_mac_ocp_write( tp, 0xF860, 0xF107 );
7791 rtl8168_mac_ocp_write( tp, 0xF862, 0x48C8 );
7792 rtl8168_mac_ocp_write( tp, 0xF864, 0x48C9 );
7793 rtl8168_mac_ocp_write( tp, 0xF866, 0xE011 );
7794 rtl8168_mac_ocp_write( tp, 0xF868, 0x48C9 );
7795 rtl8168_mac_ocp_write( tp, 0xF86A, 0x4848 );
7796 rtl8168_mac_ocp_write( tp, 0xF86C, 0xE00E );
7797 rtl8168_mac_ocp_write( tp, 0xF86E, 0x4848 );
7798 rtl8168_mac_ocp_write( tp, 0xF870, 0x49C7 );
7799 rtl8168_mac_ocp_write( tp, 0xF872, 0xF00A );
7800 rtl8168_mac_ocp_write( tp, 0xF874, 0x48C9 );
7801 rtl8168_mac_ocp_write( tp, 0xF876, 0xC60D );
7802 rtl8168_mac_ocp_write( tp, 0xF878, 0x1D1F );
7803 rtl8168_mac_ocp_write( tp, 0xF87A, 0x8DC2 );
7804 rtl8168_mac_ocp_write( tp, 0xF87C, 0x1D00 );
7805 rtl8168_mac_ocp_write( tp, 0xF87E, 0x8DC3 );
7806 rtl8168_mac_ocp_write( tp, 0xF880, 0x1D11 );
7807 rtl8168_mac_ocp_write( tp, 0xF882, 0x8DC0 );
7808 rtl8168_mac_ocp_write( tp, 0xF884, 0xE002 );
7809 rtl8168_mac_ocp_write( tp, 0xF886, 0x4849 );
7810 rtl8168_mac_ocp_write( tp, 0xF888, 0x94E5 );
7811 rtl8168_mac_ocp_write( tp, 0xF88A, 0xC602 );
7812 rtl8168_mac_ocp_write( tp, 0xF88C, 0xBE00 );
7813 rtl8168_mac_ocp_write( tp, 0xF88E, 0x0238 );
7814 rtl8168_mac_ocp_write( tp, 0xF890, 0xE434 );
7815 rtl8168_mac_ocp_write( tp, 0xF892, 0x49D9 );
7816 rtl8168_mac_ocp_write( tp, 0xF894, 0xF01B );
7817 rtl8168_mac_ocp_write( tp, 0xF896, 0xC31E );
7818 rtl8168_mac_ocp_write( tp, 0xF898, 0x7464 );
7819 rtl8168_mac_ocp_write( tp, 0xF89A, 0x49C4 );
7820 rtl8168_mac_ocp_write( tp, 0xF89C, 0xF114 );
7821 rtl8168_mac_ocp_write( tp, 0xF89E, 0xC31B );
7822 rtl8168_mac_ocp_write( tp, 0xF8A0, 0x6460 );
7823 rtl8168_mac_ocp_write( tp, 0xF8A2, 0x14FA );
7824 rtl8168_mac_ocp_write( tp, 0xF8A4, 0xFA02 );
7825 rtl8168_mac_ocp_write( tp, 0xF8A6, 0xE00F );
7826 rtl8168_mac_ocp_write( tp, 0xF8A8, 0xC317 );
7827 rtl8168_mac_ocp_write( tp, 0xF8AA, 0x7460 );
7828 rtl8168_mac_ocp_write( tp, 0xF8AC, 0x49C0 );
7829 rtl8168_mac_ocp_write( tp, 0xF8AE, 0xF10B );
7830 rtl8168_mac_ocp_write( tp, 0xF8B0, 0xC311 );
7831 rtl8168_mac_ocp_write( tp, 0xF8B2, 0x7462 );
7832 rtl8168_mac_ocp_write( tp, 0xF8B4, 0x48C1 );
7833 rtl8168_mac_ocp_write( tp, 0xF8B6, 0x9C62 );
7834 rtl8168_mac_ocp_write( tp, 0xF8B8, 0x4841 );
7835 rtl8168_mac_ocp_write( tp, 0xF8BA, 0x9C62 );
7836 rtl8168_mac_ocp_write( tp, 0xF8BC, 0xC30A );
7837 rtl8168_mac_ocp_write( tp, 0xF8BE, 0x1C04 );
7838 rtl8168_mac_ocp_write( tp, 0xF8C0, 0x8C60 );
7839 rtl8168_mac_ocp_write( tp, 0xF8C2, 0xE004 );
7840 rtl8168_mac_ocp_write( tp, 0xF8C4, 0x1C15 );
7841 rtl8168_mac_ocp_write( tp, 0xF8C6, 0xC305 );
7842 rtl8168_mac_ocp_write( tp, 0xF8C8, 0x8C60 );
7843 rtl8168_mac_ocp_write( tp, 0xF8CA, 0xC602 );
7844 rtl8168_mac_ocp_write( tp, 0xF8CC, 0xBE00 );
7845 rtl8168_mac_ocp_write( tp, 0xF8CE, 0x0374 );
7846 rtl8168_mac_ocp_write( tp, 0xF8D0, 0xE434 );
7847 rtl8168_mac_ocp_write( tp, 0xF8D2, 0xE030 );
7848 rtl8168_mac_ocp_write( tp, 0xF8D4, 0xE61C );
7849 rtl8168_mac_ocp_write( tp, 0xF8D6, 0xE906 );
7850 rtl8168_mac_ocp_write( tp, 0xF8D8, 0xC602 );
7851 rtl8168_mac_ocp_write( tp, 0xF8DA, 0xBE00 );
7852 rtl8168_mac_ocp_write( tp, 0xF8DC, 0x0000 );
7853
7854 rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
7855
7856 rtl8168_mac_ocp_write( tp, 0xFC28, 0x0493 );
7857 rtl8168_mac_ocp_write( tp, 0xFC2A, 0x0205 );
7858 rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0589 );
7859 rtl8168_mac_ocp_write( tp, 0xFC2E, 0x0647 );
7860 rtl8168_mac_ocp_write( tp, 0xFC30, 0x0000 );
7861 rtl8168_mac_ocp_write( tp, 0xFC32, 0x0215 );
7862 rtl8168_mac_ocp_write( tp, 0xFC34, 0x0285 );
7863 }
7864
7865 static void
rtl8168_set_mac_mcu_8168gu_2(struct net_device * dev)7866 rtl8168_set_mac_mcu_8168gu_2(struct net_device *dev)
7867 {
7868 struct rtl8168_private *tp = netdev_priv(dev);
7869
7870 rtl8168_hw_disable_mac_mcu_bps(dev);
7871
7872 rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
7873 rtl8168_mac_ocp_write( tp, 0xF802, 0xE00A );
7874 rtl8168_mac_ocp_write( tp, 0xF804, 0xE00D );
7875 rtl8168_mac_ocp_write( tp, 0xF806, 0xE02F );
7876 rtl8168_mac_ocp_write( tp, 0xF808, 0xE031 );
7877 rtl8168_mac_ocp_write( tp, 0xF80A, 0xE038 );
7878 rtl8168_mac_ocp_write( tp, 0xF80C, 0xE03A );
7879 rtl8168_mac_ocp_write( tp, 0xF80E, 0xE051 );
7880 rtl8168_mac_ocp_write( tp, 0xF810, 0xC202 );
7881 rtl8168_mac_ocp_write( tp, 0xF812, 0xBA00 );
7882 rtl8168_mac_ocp_write( tp, 0xF814, 0x0DFC );
7883 rtl8168_mac_ocp_write( tp, 0xF816, 0x7444 );
7884 rtl8168_mac_ocp_write( tp, 0xF818, 0xC502 );
7885 rtl8168_mac_ocp_write( tp, 0xF81A, 0xBD00 );
7886 rtl8168_mac_ocp_write( tp, 0xF81C, 0x0A30 );
7887 rtl8168_mac_ocp_write( tp, 0xF81E, 0x49D9 );
7888 rtl8168_mac_ocp_write( tp, 0xF820, 0xF019 );
7889 rtl8168_mac_ocp_write( tp, 0xF822, 0xC520 );
7890 rtl8168_mac_ocp_write( tp, 0xF824, 0x64A5 );
7891 rtl8168_mac_ocp_write( tp, 0xF826, 0x1400 );
7892 rtl8168_mac_ocp_write( tp, 0xF828, 0xF007 );
7893 rtl8168_mac_ocp_write( tp, 0xF82A, 0x0C01 );
7894 rtl8168_mac_ocp_write( tp, 0xF82C, 0x8CA5 );
7895 rtl8168_mac_ocp_write( tp, 0xF82E, 0x1C15 );
7896 rtl8168_mac_ocp_write( tp, 0xF830, 0xC515 );
7897 rtl8168_mac_ocp_write( tp, 0xF832, 0x9CA0 );
7898 rtl8168_mac_ocp_write( tp, 0xF834, 0xE00F );
7899 rtl8168_mac_ocp_write( tp, 0xF836, 0xC513 );
7900 rtl8168_mac_ocp_write( tp, 0xF838, 0x74A0 );
7901 rtl8168_mac_ocp_write( tp, 0xF83A, 0x48C8 );
7902 rtl8168_mac_ocp_write( tp, 0xF83C, 0x48CA );
7903 rtl8168_mac_ocp_write( tp, 0xF83E, 0x9CA0 );
7904 rtl8168_mac_ocp_write( tp, 0xF840, 0xC510 );
7905 rtl8168_mac_ocp_write( tp, 0xF842, 0x1B00 );
7906 rtl8168_mac_ocp_write( tp, 0xF844, 0x9BA0 );
7907 rtl8168_mac_ocp_write( tp, 0xF846, 0x1B1C );
7908 rtl8168_mac_ocp_write( tp, 0xF848, 0x483F );
7909 rtl8168_mac_ocp_write( tp, 0xF84A, 0x9BA2 );
7910 rtl8168_mac_ocp_write( tp, 0xF84C, 0x1B04 );
7911 rtl8168_mac_ocp_write( tp, 0xF84E, 0xC506 );
7912 rtl8168_mac_ocp_write( tp, 0xF850, 0x9BA0 );
7913 rtl8168_mac_ocp_write( tp, 0xF852, 0xC603 );
7914 rtl8168_mac_ocp_write( tp, 0xF854, 0xBE00 );
7915 rtl8168_mac_ocp_write( tp, 0xF856, 0x0298 );
7916 rtl8168_mac_ocp_write( tp, 0xF858, 0x03DE );
7917 rtl8168_mac_ocp_write( tp, 0xF85A, 0xE434 );
7918 rtl8168_mac_ocp_write( tp, 0xF85C, 0xE096 );
7919 rtl8168_mac_ocp_write( tp, 0xF85E, 0xE860 );
7920 rtl8168_mac_ocp_write( tp, 0xF860, 0xDE20 );
7921 rtl8168_mac_ocp_write( tp, 0xF862, 0xD3C0 );
7922 rtl8168_mac_ocp_write( tp, 0xF864, 0xC602 );
7923 rtl8168_mac_ocp_write( tp, 0xF866, 0xBE00 );
7924 rtl8168_mac_ocp_write( tp, 0xF868, 0x0A64 );
7925 rtl8168_mac_ocp_write( tp, 0xF86A, 0xC707 );
7926 rtl8168_mac_ocp_write( tp, 0xF86C, 0x1D00 );
7927 rtl8168_mac_ocp_write( tp, 0xF86E, 0x8DE2 );
7928 rtl8168_mac_ocp_write( tp, 0xF870, 0x48C1 );
7929 rtl8168_mac_ocp_write( tp, 0xF872, 0xC502 );
7930 rtl8168_mac_ocp_write( tp, 0xF874, 0xBD00 );
7931 rtl8168_mac_ocp_write( tp, 0xF876, 0x00AA );
7932 rtl8168_mac_ocp_write( tp, 0xF878, 0xE0C0 );
7933 rtl8168_mac_ocp_write( tp, 0xF87A, 0xC502 );
7934 rtl8168_mac_ocp_write( tp, 0xF87C, 0xBD00 );
7935 rtl8168_mac_ocp_write( tp, 0xF87E, 0x0132 );
7936 rtl8168_mac_ocp_write( tp, 0xF880, 0xC50C );
7937 rtl8168_mac_ocp_write( tp, 0xF882, 0x74A2 );
7938 rtl8168_mac_ocp_write( tp, 0xF884, 0x49CE );
7939 rtl8168_mac_ocp_write( tp, 0xF886, 0xF1FE );
7940 rtl8168_mac_ocp_write( tp, 0xF888, 0x1C00 );
7941 rtl8168_mac_ocp_write( tp, 0xF88A, 0x9EA0 );
7942 rtl8168_mac_ocp_write( tp, 0xF88C, 0x1C1C );
7943 rtl8168_mac_ocp_write( tp, 0xF88E, 0x484F );
7944 rtl8168_mac_ocp_write( tp, 0xF890, 0x9CA2 );
7945 rtl8168_mac_ocp_write( tp, 0xF892, 0xC402 );
7946 rtl8168_mac_ocp_write( tp, 0xF894, 0xBC00 );
7947 rtl8168_mac_ocp_write( tp, 0xF896, 0x0AFA );
7948 rtl8168_mac_ocp_write( tp, 0xF898, 0xDE20 );
7949 rtl8168_mac_ocp_write( tp, 0xF89A, 0xE000 );
7950 rtl8168_mac_ocp_write( tp, 0xF89C, 0xE092 );
7951 rtl8168_mac_ocp_write( tp, 0xF89E, 0xE430 );
7952 rtl8168_mac_ocp_write( tp, 0xF8A0, 0xDE20 );
7953 rtl8168_mac_ocp_write( tp, 0xF8A2, 0xE0C0 );
7954 rtl8168_mac_ocp_write( tp, 0xF8A4, 0xE860 );
7955 rtl8168_mac_ocp_write( tp, 0xF8A6, 0xE84C );
7956 rtl8168_mac_ocp_write( tp, 0xF8A8, 0xB400 );
7957 rtl8168_mac_ocp_write( tp, 0xF8AA, 0xB430 );
7958 rtl8168_mac_ocp_write( tp, 0xF8AC, 0xE410 );
7959 rtl8168_mac_ocp_write( tp, 0xF8AE, 0xC0AE );
7960 rtl8168_mac_ocp_write( tp, 0xF8B0, 0xB407 );
7961 rtl8168_mac_ocp_write( tp, 0xF8B2, 0xB406 );
7962 rtl8168_mac_ocp_write( tp, 0xF8B4, 0xB405 );
7963 rtl8168_mac_ocp_write( tp, 0xF8B6, 0xB404 );
7964 rtl8168_mac_ocp_write( tp, 0xF8B8, 0xB403 );
7965 rtl8168_mac_ocp_write( tp, 0xF8BA, 0xB402 );
7966 rtl8168_mac_ocp_write( tp, 0xF8BC, 0xB401 );
7967 rtl8168_mac_ocp_write( tp, 0xF8BE, 0xC7EE );
7968 rtl8168_mac_ocp_write( tp, 0xF8C0, 0x76F4 );
7969 rtl8168_mac_ocp_write( tp, 0xF8C2, 0xC2ED );
7970 rtl8168_mac_ocp_write( tp, 0xF8C4, 0xC3ED );
7971 rtl8168_mac_ocp_write( tp, 0xF8C6, 0xC1EF );
7972 rtl8168_mac_ocp_write( tp, 0xF8C8, 0xC5F3 );
7973 rtl8168_mac_ocp_write( tp, 0xF8CA, 0x74A0 );
7974 rtl8168_mac_ocp_write( tp, 0xF8CC, 0x49CD );
7975 rtl8168_mac_ocp_write( tp, 0xF8CE, 0xF001 );
7976 rtl8168_mac_ocp_write( tp, 0xF8D0, 0xC5EE );
7977 rtl8168_mac_ocp_write( tp, 0xF8D2, 0x74A0 );
7978 rtl8168_mac_ocp_write( tp, 0xF8D4, 0x49C1 );
7979 rtl8168_mac_ocp_write( tp, 0xF8D6, 0xF105 );
7980 rtl8168_mac_ocp_write( tp, 0xF8D8, 0xC5E4 );
7981 rtl8168_mac_ocp_write( tp, 0xF8DA, 0x74A2 );
7982 rtl8168_mac_ocp_write( tp, 0xF8DC, 0x49CE );
7983 rtl8168_mac_ocp_write( tp, 0xF8DE, 0xF00B );
7984 rtl8168_mac_ocp_write( tp, 0xF8E0, 0x7444 );
7985 rtl8168_mac_ocp_write( tp, 0xF8E2, 0x484B );
7986 rtl8168_mac_ocp_write( tp, 0xF8E4, 0x9C44 );
7987 rtl8168_mac_ocp_write( tp, 0xF8E6, 0x1C10 );
7988 rtl8168_mac_ocp_write( tp, 0xF8E8, 0x9C62 );
7989 rtl8168_mac_ocp_write( tp, 0xF8EA, 0x1C11 );
7990 rtl8168_mac_ocp_write( tp, 0xF8EC, 0x8C60 );
7991 rtl8168_mac_ocp_write( tp, 0xF8EE, 0x1C00 );
7992 rtl8168_mac_ocp_write( tp, 0xF8F0, 0x9CF6 );
7993 rtl8168_mac_ocp_write( tp, 0xF8F2, 0xE0EC );
7994 rtl8168_mac_ocp_write( tp, 0xF8F4, 0x49E7 );
7995 rtl8168_mac_ocp_write( tp, 0xF8F6, 0xF016 );
7996 rtl8168_mac_ocp_write( tp, 0xF8F8, 0x1D80 );
7997 rtl8168_mac_ocp_write( tp, 0xF8FA, 0x8DF4 );
7998 rtl8168_mac_ocp_write( tp, 0xF8FC, 0x74F8 );
7999 rtl8168_mac_ocp_write( tp, 0xF8FE, 0x4843 );
8000 rtl8168_mac_ocp_write( tp, 0xF900, 0x8CF8 );
8001 rtl8168_mac_ocp_write( tp, 0xF902, 0x74F8 );
8002 rtl8168_mac_ocp_write( tp, 0xF904, 0x74F8 );
8003 rtl8168_mac_ocp_write( tp, 0xF906, 0x7444 );
8004 rtl8168_mac_ocp_write( tp, 0xF908, 0x48C8 );
8005 rtl8168_mac_ocp_write( tp, 0xF90A, 0x48C9 );
8006 rtl8168_mac_ocp_write( tp, 0xF90C, 0x48CA );
8007 rtl8168_mac_ocp_write( tp, 0xF90E, 0x9C44 );
8008 rtl8168_mac_ocp_write( tp, 0xF910, 0x74F8 );
8009 rtl8168_mac_ocp_write( tp, 0xF912, 0x4844 );
8010 rtl8168_mac_ocp_write( tp, 0xF914, 0x8CF8 );
8011 rtl8168_mac_ocp_write( tp, 0xF916, 0x1E01 );
8012 rtl8168_mac_ocp_write( tp, 0xF918, 0xE8DB );
8013 rtl8168_mac_ocp_write( tp, 0xF91A, 0x7420 );
8014 rtl8168_mac_ocp_write( tp, 0xF91C, 0x48C1 );
8015 rtl8168_mac_ocp_write( tp, 0xF91E, 0x9C20 );
8016 rtl8168_mac_ocp_write( tp, 0xF920, 0xE0D5 );
8017 rtl8168_mac_ocp_write( tp, 0xF922, 0x49E6 );
8018 rtl8168_mac_ocp_write( tp, 0xF924, 0xF02A );
8019 rtl8168_mac_ocp_write( tp, 0xF926, 0x1D40 );
8020 rtl8168_mac_ocp_write( tp, 0xF928, 0x8DF4 );
8021 rtl8168_mac_ocp_write( tp, 0xF92A, 0x74FC );
8022 rtl8168_mac_ocp_write( tp, 0xF92C, 0x49C0 );
8023 rtl8168_mac_ocp_write( tp, 0xF92E, 0xF124 );
8024 rtl8168_mac_ocp_write( tp, 0xF930, 0x49C1 );
8025 rtl8168_mac_ocp_write( tp, 0xF932, 0xF122 );
8026 rtl8168_mac_ocp_write( tp, 0xF934, 0x74F8 );
8027 rtl8168_mac_ocp_write( tp, 0xF936, 0x49C0 );
8028 rtl8168_mac_ocp_write( tp, 0xF938, 0xF01F );
8029 rtl8168_mac_ocp_write( tp, 0xF93A, 0xE8D3 );
8030 rtl8168_mac_ocp_write( tp, 0xF93C, 0x48C4 );
8031 rtl8168_mac_ocp_write( tp, 0xF93E, 0x8CF8 );
8032 rtl8168_mac_ocp_write( tp, 0xF940, 0x1E00 );
8033 rtl8168_mac_ocp_write( tp, 0xF942, 0xE8C6 );
8034 rtl8168_mac_ocp_write( tp, 0xF944, 0xC5B1 );
8035 rtl8168_mac_ocp_write( tp, 0xF946, 0x74A0 );
8036 rtl8168_mac_ocp_write( tp, 0xF948, 0x49C3 );
8037 rtl8168_mac_ocp_write( tp, 0xF94A, 0xF016 );
8038 rtl8168_mac_ocp_write( tp, 0xF94C, 0xC5AF );
8039 rtl8168_mac_ocp_write( tp, 0xF94E, 0x74A4 );
8040 rtl8168_mac_ocp_write( tp, 0xF950, 0x49C2 );
8041 rtl8168_mac_ocp_write( tp, 0xF952, 0xF005 );
8042 rtl8168_mac_ocp_write( tp, 0xF954, 0xC5AA );
8043 rtl8168_mac_ocp_write( tp, 0xF956, 0x74B2 );
8044 rtl8168_mac_ocp_write( tp, 0xF958, 0x49C9 );
8045 rtl8168_mac_ocp_write( tp, 0xF95A, 0xF10E );
8046 rtl8168_mac_ocp_write( tp, 0xF95C, 0xC5A6 );
8047 rtl8168_mac_ocp_write( tp, 0xF95E, 0x74A8 );
8048 rtl8168_mac_ocp_write( tp, 0xF960, 0x4845 );
8049 rtl8168_mac_ocp_write( tp, 0xF962, 0x4846 );
8050 rtl8168_mac_ocp_write( tp, 0xF964, 0x4847 );
8051 rtl8168_mac_ocp_write( tp, 0xF966, 0x4848 );
8052 rtl8168_mac_ocp_write( tp, 0xF968, 0x9CA8 );
8053 rtl8168_mac_ocp_write( tp, 0xF96A, 0x74B2 );
8054 rtl8168_mac_ocp_write( tp, 0xF96C, 0x4849 );
8055 rtl8168_mac_ocp_write( tp, 0xF96E, 0x9CB2 );
8056 rtl8168_mac_ocp_write( tp, 0xF970, 0x74A0 );
8057 rtl8168_mac_ocp_write( tp, 0xF972, 0x484F );
8058 rtl8168_mac_ocp_write( tp, 0xF974, 0x9CA0 );
8059 rtl8168_mac_ocp_write( tp, 0xF976, 0xE0AA );
8060 rtl8168_mac_ocp_write( tp, 0xF978, 0x49E4 );
8061 rtl8168_mac_ocp_write( tp, 0xF97A, 0xF018 );
8062 rtl8168_mac_ocp_write( tp, 0xF97C, 0x1D10 );
8063 rtl8168_mac_ocp_write( tp, 0xF97E, 0x8DF4 );
8064 rtl8168_mac_ocp_write( tp, 0xF980, 0x74F8 );
8065 rtl8168_mac_ocp_write( tp, 0xF982, 0x74F8 );
8066 rtl8168_mac_ocp_write( tp, 0xF984, 0x74F8 );
8067 rtl8168_mac_ocp_write( tp, 0xF986, 0x4843 );
8068 rtl8168_mac_ocp_write( tp, 0xF988, 0x8CF8 );
8069 rtl8168_mac_ocp_write( tp, 0xF98A, 0x74F8 );
8070 rtl8168_mac_ocp_write( tp, 0xF98C, 0x74F8 );
8071 rtl8168_mac_ocp_write( tp, 0xF98E, 0x74F8 );
8072 rtl8168_mac_ocp_write( tp, 0xF990, 0x4844 );
8073 rtl8168_mac_ocp_write( tp, 0xF992, 0x4842 );
8074 rtl8168_mac_ocp_write( tp, 0xF994, 0x4841 );
8075 rtl8168_mac_ocp_write( tp, 0xF996, 0x8CF8 );
8076 rtl8168_mac_ocp_write( tp, 0xF998, 0x1E01 );
8077 rtl8168_mac_ocp_write( tp, 0xF99A, 0xE89A );
8078 rtl8168_mac_ocp_write( tp, 0xF99C, 0x7420 );
8079 rtl8168_mac_ocp_write( tp, 0xF99E, 0x4841 );
8080 rtl8168_mac_ocp_write( tp, 0xF9A0, 0x9C20 );
8081 rtl8168_mac_ocp_write( tp, 0xF9A2, 0x7444 );
8082 rtl8168_mac_ocp_write( tp, 0xF9A4, 0x4848 );
8083 rtl8168_mac_ocp_write( tp, 0xF9A6, 0x9C44 );
8084 rtl8168_mac_ocp_write( tp, 0xF9A8, 0xE091 );
8085 rtl8168_mac_ocp_write( tp, 0xF9AA, 0x49E5 );
8086 rtl8168_mac_ocp_write( tp, 0xF9AC, 0xF03E );
8087 rtl8168_mac_ocp_write( tp, 0xF9AE, 0x1D20 );
8088 rtl8168_mac_ocp_write( tp, 0xF9B0, 0x8DF4 );
8089 rtl8168_mac_ocp_write( tp, 0xF9B2, 0x74F8 );
8090 rtl8168_mac_ocp_write( tp, 0xF9B4, 0x48C2 );
8091 rtl8168_mac_ocp_write( tp, 0xF9B6, 0x4841 );
8092 rtl8168_mac_ocp_write( tp, 0xF9B8, 0x8CF8 );
8093 rtl8168_mac_ocp_write( tp, 0xF9BA, 0x1E01 );
8094 rtl8168_mac_ocp_write( tp, 0xF9BC, 0x7444 );
8095 rtl8168_mac_ocp_write( tp, 0xF9BE, 0x49CA );
8096 rtl8168_mac_ocp_write( tp, 0xF9C0, 0xF103 );
8097 rtl8168_mac_ocp_write( tp, 0xF9C2, 0x49C2 );
8098 rtl8168_mac_ocp_write( tp, 0xF9C4, 0xF00C );
8099 rtl8168_mac_ocp_write( tp, 0xF9C6, 0x49C1 );
8100 rtl8168_mac_ocp_write( tp, 0xF9C8, 0xF004 );
8101 rtl8168_mac_ocp_write( tp, 0xF9CA, 0x6447 );
8102 rtl8168_mac_ocp_write( tp, 0xF9CC, 0x2244 );
8103 rtl8168_mac_ocp_write( tp, 0xF9CE, 0xE002 );
8104 rtl8168_mac_ocp_write( tp, 0xF9D0, 0x1C01 );
8105 rtl8168_mac_ocp_write( tp, 0xF9D2, 0x9C62 );
8106 rtl8168_mac_ocp_write( tp, 0xF9D4, 0x1C11 );
8107 rtl8168_mac_ocp_write( tp, 0xF9D6, 0x8C60 );
8108 rtl8168_mac_ocp_write( tp, 0xF9D8, 0x1C00 );
8109 rtl8168_mac_ocp_write( tp, 0xF9DA, 0x9CF6 );
8110 rtl8168_mac_ocp_write( tp, 0xF9DC, 0x7444 );
8111 rtl8168_mac_ocp_write( tp, 0xF9DE, 0x49C8 );
8112 rtl8168_mac_ocp_write( tp, 0xF9E0, 0xF01D );
8113 rtl8168_mac_ocp_write( tp, 0xF9E2, 0x74FC );
8114 rtl8168_mac_ocp_write( tp, 0xF9E4, 0x49C0 );
8115 rtl8168_mac_ocp_write( tp, 0xF9E6, 0xF11A );
8116 rtl8168_mac_ocp_write( tp, 0xF9E8, 0x49C1 );
8117 rtl8168_mac_ocp_write( tp, 0xF9EA, 0xF118 );
8118 rtl8168_mac_ocp_write( tp, 0xF9EC, 0x74F8 );
8119 rtl8168_mac_ocp_write( tp, 0xF9EE, 0x49C0 );
8120 rtl8168_mac_ocp_write( tp, 0xF9F0, 0xF015 );
8121 rtl8168_mac_ocp_write( tp, 0xF9F2, 0x49C6 );
8122 rtl8168_mac_ocp_write( tp, 0xF9F4, 0xF113 );
8123 rtl8168_mac_ocp_write( tp, 0xF9F6, 0xE875 );
8124 rtl8168_mac_ocp_write( tp, 0xF9F8, 0x48C4 );
8125 rtl8168_mac_ocp_write( tp, 0xF9FA, 0x8CF8 );
8126 rtl8168_mac_ocp_write( tp, 0xF9FC, 0x7420 );
8127 rtl8168_mac_ocp_write( tp, 0xF9FE, 0x48C1 );
8128 rtl8168_mac_ocp_write( tp, 0xFA00, 0x9C20 );
8129 rtl8168_mac_ocp_write( tp, 0xFA02, 0xC50A );
8130 rtl8168_mac_ocp_write( tp, 0xFA04, 0x74A2 );
8131 rtl8168_mac_ocp_write( tp, 0xFA06, 0x8CA5 );
8132 rtl8168_mac_ocp_write( tp, 0xFA08, 0x74A0 );
8133 rtl8168_mac_ocp_write( tp, 0xFA0A, 0xC505 );
8134 rtl8168_mac_ocp_write( tp, 0xFA0C, 0x9CA2 );
8135 rtl8168_mac_ocp_write( tp, 0xFA0E, 0x1C11 );
8136 rtl8168_mac_ocp_write( tp, 0xFA10, 0x9CA0 );
8137 rtl8168_mac_ocp_write( tp, 0xFA12, 0xE00A );
8138 rtl8168_mac_ocp_write( tp, 0xFA14, 0xE434 );
8139 rtl8168_mac_ocp_write( tp, 0xFA16, 0xD3C0 );
8140 rtl8168_mac_ocp_write( tp, 0xFA18, 0xDC00 );
8141 rtl8168_mac_ocp_write( tp, 0xFA1A, 0x7444 );
8142 rtl8168_mac_ocp_write( tp, 0xFA1C, 0x49CA );
8143 rtl8168_mac_ocp_write( tp, 0xFA1E, 0xF004 );
8144 rtl8168_mac_ocp_write( tp, 0xFA20, 0x48CA );
8145 rtl8168_mac_ocp_write( tp, 0xFA22, 0x9C44 );
8146 rtl8168_mac_ocp_write( tp, 0xFA24, 0xE855 );
8147 rtl8168_mac_ocp_write( tp, 0xFA26, 0xE052 );
8148 rtl8168_mac_ocp_write( tp, 0xFA28, 0x49E8 );
8149 rtl8168_mac_ocp_write( tp, 0xFA2A, 0xF024 );
8150 rtl8168_mac_ocp_write( tp, 0xFA2C, 0x1D01 );
8151 rtl8168_mac_ocp_write( tp, 0xFA2E, 0x8DF5 );
8152 rtl8168_mac_ocp_write( tp, 0xFA30, 0x7440 );
8153 rtl8168_mac_ocp_write( tp, 0xFA32, 0x49C0 );
8154 rtl8168_mac_ocp_write( tp, 0xFA34, 0xF11E );
8155 rtl8168_mac_ocp_write( tp, 0xFA36, 0x7444 );
8156 rtl8168_mac_ocp_write( tp, 0xFA38, 0x49C8 );
8157 rtl8168_mac_ocp_write( tp, 0xFA3A, 0xF01B );
8158 rtl8168_mac_ocp_write( tp, 0xFA3C, 0x49CA );
8159 rtl8168_mac_ocp_write( tp, 0xFA3E, 0xF119 );
8160 rtl8168_mac_ocp_write( tp, 0xFA40, 0xC5EC );
8161 rtl8168_mac_ocp_write( tp, 0xFA42, 0x76A4 );
8162 rtl8168_mac_ocp_write( tp, 0xFA44, 0x49E3 );
8163 rtl8168_mac_ocp_write( tp, 0xFA46, 0xF015 );
8164 rtl8168_mac_ocp_write( tp, 0xFA48, 0x49C0 );
8165 rtl8168_mac_ocp_write( tp, 0xFA4A, 0xF103 );
8166 rtl8168_mac_ocp_write( tp, 0xFA4C, 0x49C1 );
8167 rtl8168_mac_ocp_write( tp, 0xFA4E, 0xF011 );
8168 rtl8168_mac_ocp_write( tp, 0xFA50, 0x4849 );
8169 rtl8168_mac_ocp_write( tp, 0xFA52, 0x9C44 );
8170 rtl8168_mac_ocp_write( tp, 0xFA54, 0x1C00 );
8171 rtl8168_mac_ocp_write( tp, 0xFA56, 0x9CF6 );
8172 rtl8168_mac_ocp_write( tp, 0xFA58, 0x7444 );
8173 rtl8168_mac_ocp_write( tp, 0xFA5A, 0x49C1 );
8174 rtl8168_mac_ocp_write( tp, 0xFA5C, 0xF004 );
8175 rtl8168_mac_ocp_write( tp, 0xFA5E, 0x6446 );
8176 rtl8168_mac_ocp_write( tp, 0xFA60, 0x1E07 );
8177 rtl8168_mac_ocp_write( tp, 0xFA62, 0xE003 );
8178 rtl8168_mac_ocp_write( tp, 0xFA64, 0x1C01 );
8179 rtl8168_mac_ocp_write( tp, 0xFA66, 0x1E03 );
8180 rtl8168_mac_ocp_write( tp, 0xFA68, 0x9C62 );
8181 rtl8168_mac_ocp_write( tp, 0xFA6A, 0x1C11 );
8182 rtl8168_mac_ocp_write( tp, 0xFA6C, 0x8C60 );
8183 rtl8168_mac_ocp_write( tp, 0xFA6E, 0xE830 );
8184 rtl8168_mac_ocp_write( tp, 0xFA70, 0xE02D );
8185 rtl8168_mac_ocp_write( tp, 0xFA72, 0x49E9 );
8186 rtl8168_mac_ocp_write( tp, 0xFA74, 0xF004 );
8187 rtl8168_mac_ocp_write( tp, 0xFA76, 0x1D02 );
8188 rtl8168_mac_ocp_write( tp, 0xFA78, 0x8DF5 );
8189 rtl8168_mac_ocp_write( tp, 0xFA7A, 0xE79C );
8190 rtl8168_mac_ocp_write( tp, 0xFA7C, 0x49E3 );
8191 rtl8168_mac_ocp_write( tp, 0xFA7E, 0xF006 );
8192 rtl8168_mac_ocp_write( tp, 0xFA80, 0x1D08 );
8193 rtl8168_mac_ocp_write( tp, 0xFA82, 0x8DF4 );
8194 rtl8168_mac_ocp_write( tp, 0xFA84, 0x74F8 );
8195 rtl8168_mac_ocp_write( tp, 0xFA86, 0x74F8 );
8196 rtl8168_mac_ocp_write( tp, 0xFA88, 0xE73A );
8197 rtl8168_mac_ocp_write( tp, 0xFA8A, 0x49E1 );
8198 rtl8168_mac_ocp_write( tp, 0xFA8C, 0xF007 );
8199 rtl8168_mac_ocp_write( tp, 0xFA8E, 0x1D02 );
8200 rtl8168_mac_ocp_write( tp, 0xFA90, 0x8DF4 );
8201 rtl8168_mac_ocp_write( tp, 0xFA92, 0x1E01 );
8202 rtl8168_mac_ocp_write( tp, 0xFA94, 0xE7A7 );
8203 rtl8168_mac_ocp_write( tp, 0xFA96, 0xDE20 );
8204 rtl8168_mac_ocp_write( tp, 0xFA98, 0xE410 );
8205 rtl8168_mac_ocp_write( tp, 0xFA9A, 0x49E0 );
8206 rtl8168_mac_ocp_write( tp, 0xFA9C, 0xF017 );
8207 rtl8168_mac_ocp_write( tp, 0xFA9E, 0x1D01 );
8208 rtl8168_mac_ocp_write( tp, 0xFAA0, 0x8DF4 );
8209 rtl8168_mac_ocp_write( tp, 0xFAA2, 0xC5FA );
8210 rtl8168_mac_ocp_write( tp, 0xFAA4, 0x1C00 );
8211 rtl8168_mac_ocp_write( tp, 0xFAA6, 0x8CA0 );
8212 rtl8168_mac_ocp_write( tp, 0xFAA8, 0x1C1B );
8213 rtl8168_mac_ocp_write( tp, 0xFAAA, 0x9CA2 );
8214 rtl8168_mac_ocp_write( tp, 0xFAAC, 0x74A2 );
8215 rtl8168_mac_ocp_write( tp, 0xFAAE, 0x49CF );
8216 rtl8168_mac_ocp_write( tp, 0xFAB0, 0xF0FE );
8217 rtl8168_mac_ocp_write( tp, 0xFAB2, 0xC5F3 );
8218 rtl8168_mac_ocp_write( tp, 0xFAB4, 0x74A0 );
8219 rtl8168_mac_ocp_write( tp, 0xFAB6, 0x4849 );
8220 rtl8168_mac_ocp_write( tp, 0xFAB8, 0x9CA0 );
8221 rtl8168_mac_ocp_write( tp, 0xFABA, 0x74F8 );
8222 rtl8168_mac_ocp_write( tp, 0xFABC, 0x49C0 );
8223 rtl8168_mac_ocp_write( tp, 0xFABE, 0xF006 );
8224 rtl8168_mac_ocp_write( tp, 0xFAC0, 0x48C3 );
8225 rtl8168_mac_ocp_write( tp, 0xFAC2, 0x8CF8 );
8226 rtl8168_mac_ocp_write( tp, 0xFAC4, 0xE820 );
8227 rtl8168_mac_ocp_write( tp, 0xFAC6, 0x74F8 );
8228 rtl8168_mac_ocp_write( tp, 0xFAC8, 0x74F8 );
8229 rtl8168_mac_ocp_write( tp, 0xFACA, 0xC432 );
8230 rtl8168_mac_ocp_write( tp, 0xFACC, 0xBC00 );
8231 rtl8168_mac_ocp_write( tp, 0xFACE, 0xC5E4 );
8232 rtl8168_mac_ocp_write( tp, 0xFAD0, 0x74A2 );
8233 rtl8168_mac_ocp_write( tp, 0xFAD2, 0x49CE );
8234 rtl8168_mac_ocp_write( tp, 0xFAD4, 0xF1FE );
8235 rtl8168_mac_ocp_write( tp, 0xFAD6, 0x9EA0 );
8236 rtl8168_mac_ocp_write( tp, 0xFAD8, 0x1C1C );
8237 rtl8168_mac_ocp_write( tp, 0xFADA, 0x484F );
8238 rtl8168_mac_ocp_write( tp, 0xFADC, 0x9CA2 );
8239 rtl8168_mac_ocp_write( tp, 0xFADE, 0xFF80 );
8240 rtl8168_mac_ocp_write( tp, 0xFAE0, 0xB404 );
8241 rtl8168_mac_ocp_write( tp, 0xFAE2, 0xB405 );
8242 rtl8168_mac_ocp_write( tp, 0xFAE4, 0xC5D9 );
8243 rtl8168_mac_ocp_write( tp, 0xFAE6, 0x74A2 );
8244 rtl8168_mac_ocp_write( tp, 0xFAE8, 0x49CE );
8245 rtl8168_mac_ocp_write( tp, 0xFAEA, 0xF1FE );
8246 rtl8168_mac_ocp_write( tp, 0xFAEC, 0xC41F );
8247 rtl8168_mac_ocp_write( tp, 0xFAEE, 0x9CA0 );
8248 rtl8168_mac_ocp_write( tp, 0xFAF0, 0xC41C );
8249 rtl8168_mac_ocp_write( tp, 0xFAF2, 0x1C13 );
8250 rtl8168_mac_ocp_write( tp, 0xFAF4, 0x484F );
8251 rtl8168_mac_ocp_write( tp, 0xFAF6, 0x9CA2 );
8252 rtl8168_mac_ocp_write( tp, 0xFAF8, 0x74A2 );
8253 rtl8168_mac_ocp_write( tp, 0xFAFA, 0x49CF );
8254 rtl8168_mac_ocp_write( tp, 0xFAFC, 0xF1FE );
8255 rtl8168_mac_ocp_write( tp, 0xFAFE, 0xB005 );
8256 rtl8168_mac_ocp_write( tp, 0xFB00, 0xB004 );
8257 rtl8168_mac_ocp_write( tp, 0xFB02, 0xFF80 );
8258 rtl8168_mac_ocp_write( tp, 0xFB04, 0xB404 );
8259 rtl8168_mac_ocp_write( tp, 0xFB06, 0xB405 );
8260 rtl8168_mac_ocp_write( tp, 0xFB08, 0xC5C7 );
8261 rtl8168_mac_ocp_write( tp, 0xFB0A, 0x74A2 );
8262 rtl8168_mac_ocp_write( tp, 0xFB0C, 0x49CE );
8263 rtl8168_mac_ocp_write( tp, 0xFB0E, 0xF1FE );
8264 rtl8168_mac_ocp_write( tp, 0xFB10, 0xC40E );
8265 rtl8168_mac_ocp_write( tp, 0xFB12, 0x9CA0 );
8266 rtl8168_mac_ocp_write( tp, 0xFB14, 0xC40A );
8267 rtl8168_mac_ocp_write( tp, 0xFB16, 0x1C13 );
8268 rtl8168_mac_ocp_write( tp, 0xFB18, 0x484F );
8269 rtl8168_mac_ocp_write( tp, 0xFB1A, 0x9CA2 );
8270 rtl8168_mac_ocp_write( tp, 0xFB1C, 0x74A2 );
8271 rtl8168_mac_ocp_write( tp, 0xFB1E, 0x49CF );
8272 rtl8168_mac_ocp_write( tp, 0xFB20, 0xF1FE );
8273 rtl8168_mac_ocp_write( tp, 0xFB22, 0xB005 );
8274 rtl8168_mac_ocp_write( tp, 0xFB24, 0xB004 );
8275 rtl8168_mac_ocp_write( tp, 0xFB26, 0xFF80 );
8276 rtl8168_mac_ocp_write( tp, 0xFB28, 0x0000 );
8277 rtl8168_mac_ocp_write( tp, 0xFB2A, 0x0481 );
8278 rtl8168_mac_ocp_write( tp, 0xFB2C, 0x0C81 );
8279 rtl8168_mac_ocp_write( tp, 0xFB2E, 0x0AE0 );
8280
8281
8282 rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
8283
8284 rtl8168_mac_ocp_write( tp, 0xFC28, 0x0000 );
8285 rtl8168_mac_ocp_write( tp, 0xFC2A, 0x0000 );
8286 rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0297 );
8287 rtl8168_mac_ocp_write( tp, 0xFC2E, 0x0000 );
8288 rtl8168_mac_ocp_write( tp, 0xFC30, 0x00A9 );
8289 rtl8168_mac_ocp_write( tp, 0xFC32, 0x012D );
8290 rtl8168_mac_ocp_write( tp, 0xFC34, 0x0000 );
8291 rtl8168_mac_ocp_write( tp, 0xFC36, 0x08DF );
8292 }
8293
8294 static void
rtl8168_set_mac_mcu_8411b_1(struct net_device * dev)8295 rtl8168_set_mac_mcu_8411b_1(struct net_device *dev)
8296 {
8297 struct rtl8168_private *tp = netdev_priv(dev);
8298
8299 rtl8168_hw_disable_mac_mcu_bps(dev);
8300
8301 rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
8302 rtl8168_mac_ocp_write( tp, 0xF802, 0xE00A );
8303 rtl8168_mac_ocp_write( tp, 0xF804, 0xE00C );
8304 rtl8168_mac_ocp_write( tp, 0xF806, 0xE00E );
8305 rtl8168_mac_ocp_write( tp, 0xF808, 0xE027 );
8306 rtl8168_mac_ocp_write( tp, 0xF80A, 0xE04F );
8307 rtl8168_mac_ocp_write( tp, 0xF80C, 0xE05E );
8308 rtl8168_mac_ocp_write( tp, 0xF80E, 0xE065 );
8309 rtl8168_mac_ocp_write( tp, 0xF810, 0xC602 );
8310 rtl8168_mac_ocp_write( tp, 0xF812, 0xBE00 );
8311 rtl8168_mac_ocp_write( tp, 0xF814, 0x0000 );
8312 rtl8168_mac_ocp_write( tp, 0xF816, 0xC502 );
8313 rtl8168_mac_ocp_write( tp, 0xF818, 0xBD00 );
8314 rtl8168_mac_ocp_write( tp, 0xF81A, 0x074C );
8315 rtl8168_mac_ocp_write( tp, 0xF81C, 0xC302 );
8316 rtl8168_mac_ocp_write( tp, 0xF81E, 0xBB00 );
8317 rtl8168_mac_ocp_write( tp, 0xF820, 0x080A );
8318 rtl8168_mac_ocp_write( tp, 0xF822, 0x6420 );
8319 rtl8168_mac_ocp_write( tp, 0xF824, 0x48C2 );
8320 rtl8168_mac_ocp_write( tp, 0xF826, 0x8C20 );
8321 rtl8168_mac_ocp_write( tp, 0xF828, 0xC516 );
8322 rtl8168_mac_ocp_write( tp, 0xF82A, 0x64A4 );
8323 rtl8168_mac_ocp_write( tp, 0xF82C, 0x49C0 );
8324 rtl8168_mac_ocp_write( tp, 0xF82E, 0xF009 );
8325 rtl8168_mac_ocp_write( tp, 0xF830, 0x74A2 );
8326 rtl8168_mac_ocp_write( tp, 0xF832, 0x8CA5 );
8327 rtl8168_mac_ocp_write( tp, 0xF834, 0x74A0 );
8328 rtl8168_mac_ocp_write( tp, 0xF836, 0xC50E );
8329 rtl8168_mac_ocp_write( tp, 0xF838, 0x9CA2 );
8330 rtl8168_mac_ocp_write( tp, 0xF83A, 0x1C11 );
8331 rtl8168_mac_ocp_write( tp, 0xF83C, 0x9CA0 );
8332 rtl8168_mac_ocp_write( tp, 0xF83E, 0xE006 );
8333 rtl8168_mac_ocp_write( tp, 0xF840, 0x74F8 );
8334 rtl8168_mac_ocp_write( tp, 0xF842, 0x48C4 );
8335 rtl8168_mac_ocp_write( tp, 0xF844, 0x8CF8 );
8336 rtl8168_mac_ocp_write( tp, 0xF846, 0xC404 );
8337 rtl8168_mac_ocp_write( tp, 0xF848, 0xBC00 );
8338 rtl8168_mac_ocp_write( tp, 0xF84A, 0xC403 );
8339 rtl8168_mac_ocp_write( tp, 0xF84C, 0xBC00 );
8340 rtl8168_mac_ocp_write( tp, 0xF84E, 0x0BF2 );
8341 rtl8168_mac_ocp_write( tp, 0xF850, 0x0C0A );
8342 rtl8168_mac_ocp_write( tp, 0xF852, 0xE434 );
8343 rtl8168_mac_ocp_write( tp, 0xF854, 0xD3C0 );
8344 rtl8168_mac_ocp_write( tp, 0xF856, 0x49D9 );
8345 rtl8168_mac_ocp_write( tp, 0xF858, 0xF01F );
8346 rtl8168_mac_ocp_write( tp, 0xF85A, 0xC526 );
8347 rtl8168_mac_ocp_write( tp, 0xF85C, 0x64A5 );
8348 rtl8168_mac_ocp_write( tp, 0xF85E, 0x1400 );
8349 rtl8168_mac_ocp_write( tp, 0xF860, 0xF007 );
8350 rtl8168_mac_ocp_write( tp, 0xF862, 0x0C01 );
8351 rtl8168_mac_ocp_write( tp, 0xF864, 0x8CA5 );
8352 rtl8168_mac_ocp_write( tp, 0xF866, 0x1C15 );
8353 rtl8168_mac_ocp_write( tp, 0xF868, 0xC51B );
8354 rtl8168_mac_ocp_write( tp, 0xF86A, 0x9CA0 );
8355 rtl8168_mac_ocp_write( tp, 0xF86C, 0xE013 );
8356 rtl8168_mac_ocp_write( tp, 0xF86E, 0xC519 );
8357 rtl8168_mac_ocp_write( tp, 0xF870, 0x74A0 );
8358 rtl8168_mac_ocp_write( tp, 0xF872, 0x48C4 );
8359 rtl8168_mac_ocp_write( tp, 0xF874, 0x8CA0 );
8360 rtl8168_mac_ocp_write( tp, 0xF876, 0xC516 );
8361 rtl8168_mac_ocp_write( tp, 0xF878, 0x74A4 );
8362 rtl8168_mac_ocp_write( tp, 0xF87A, 0x48C8 );
8363 rtl8168_mac_ocp_write( tp, 0xF87C, 0x48CA );
8364 rtl8168_mac_ocp_write( tp, 0xF87E, 0x9CA4 );
8365 rtl8168_mac_ocp_write( tp, 0xF880, 0xC512 );
8366 rtl8168_mac_ocp_write( tp, 0xF882, 0x1B00 );
8367 rtl8168_mac_ocp_write( tp, 0xF884, 0x9BA0 );
8368 rtl8168_mac_ocp_write( tp, 0xF886, 0x1B1C );
8369 rtl8168_mac_ocp_write( tp, 0xF888, 0x483F );
8370 rtl8168_mac_ocp_write( tp, 0xF88A, 0x9BA2 );
8371 rtl8168_mac_ocp_write( tp, 0xF88C, 0x1B04 );
8372 rtl8168_mac_ocp_write( tp, 0xF88E, 0xC508 );
8373 rtl8168_mac_ocp_write( tp, 0xF890, 0x9BA0 );
8374 rtl8168_mac_ocp_write( tp, 0xF892, 0xC505 );
8375 rtl8168_mac_ocp_write( tp, 0xF894, 0xBD00 );
8376 rtl8168_mac_ocp_write( tp, 0xF896, 0xC502 );
8377 rtl8168_mac_ocp_write( tp, 0xF898, 0xBD00 );
8378 rtl8168_mac_ocp_write( tp, 0xF89A, 0x0300 );
8379 rtl8168_mac_ocp_write( tp, 0xF89C, 0x051E );
8380 rtl8168_mac_ocp_write( tp, 0xF89E, 0xE434 );
8381 rtl8168_mac_ocp_write( tp, 0xF8A0, 0xE018 );
8382 rtl8168_mac_ocp_write( tp, 0xF8A2, 0xE092 );
8383 rtl8168_mac_ocp_write( tp, 0xF8A4, 0xDE20 );
8384 rtl8168_mac_ocp_write( tp, 0xF8A6, 0xD3C0 );
8385 rtl8168_mac_ocp_write( tp, 0xF8A8, 0xC50F );
8386 rtl8168_mac_ocp_write( tp, 0xF8AA, 0x76A4 );
8387 rtl8168_mac_ocp_write( tp, 0xF8AC, 0x49E3 );
8388 rtl8168_mac_ocp_write( tp, 0xF8AE, 0xF007 );
8389 rtl8168_mac_ocp_write( tp, 0xF8B0, 0x49C0 );
8390 rtl8168_mac_ocp_write( tp, 0xF8B2, 0xF103 );
8391 rtl8168_mac_ocp_write( tp, 0xF8B4, 0xC607 );
8392 rtl8168_mac_ocp_write( tp, 0xF8B6, 0xBE00 );
8393 rtl8168_mac_ocp_write( tp, 0xF8B8, 0xC606 );
8394 rtl8168_mac_ocp_write( tp, 0xF8BA, 0xBE00 );
8395 rtl8168_mac_ocp_write( tp, 0xF8BC, 0xC602 );
8396 rtl8168_mac_ocp_write( tp, 0xF8BE, 0xBE00 );
8397 rtl8168_mac_ocp_write( tp, 0xF8C0, 0x0C4C );
8398 rtl8168_mac_ocp_write( tp, 0xF8C2, 0x0C28 );
8399 rtl8168_mac_ocp_write( tp, 0xF8C4, 0x0C2C );
8400 rtl8168_mac_ocp_write( tp, 0xF8C6, 0xDC00 );
8401 rtl8168_mac_ocp_write( tp, 0xF8C8, 0xC707 );
8402 rtl8168_mac_ocp_write( tp, 0xF8CA, 0x1D00 );
8403 rtl8168_mac_ocp_write( tp, 0xF8CC, 0x8DE2 );
8404 rtl8168_mac_ocp_write( tp, 0xF8CE, 0x48C1 );
8405 rtl8168_mac_ocp_write( tp, 0xF8D0, 0xC502 );
8406 rtl8168_mac_ocp_write( tp, 0xF8D2, 0xBD00 );
8407 rtl8168_mac_ocp_write( tp, 0xF8D4, 0x00AA );
8408 rtl8168_mac_ocp_write( tp, 0xF8D6, 0xE0C0 );
8409 rtl8168_mac_ocp_write( tp, 0xF8D8, 0xC502 );
8410 rtl8168_mac_ocp_write( tp, 0xF8DA, 0xBD00 );
8411 rtl8168_mac_ocp_write( tp, 0xF8DC, 0x0132 );
8412
8413 rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
8414
8415 rtl8168_mac_ocp_write( tp, 0xFC2A, 0x0743 );
8416 rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0801 );
8417 rtl8168_mac_ocp_write( tp, 0xFC2E, 0x0BE9 );
8418 rtl8168_mac_ocp_write( tp, 0xFC30, 0x02FD );
8419 rtl8168_mac_ocp_write( tp, 0xFC32, 0x0C25 );
8420 rtl8168_mac_ocp_write( tp, 0xFC34, 0x00A9 );
8421 rtl8168_mac_ocp_write( tp, 0xFC36, 0x012D );
8422 }
8423
8424 static void
rtl8168_set_mac_mcu_8168ep_1(struct net_device * dev)8425 rtl8168_set_mac_mcu_8168ep_1(struct net_device *dev)
8426 {
8427 struct rtl8168_private *tp = netdev_priv(dev);
8428 u16 i;
8429 static const u16 mcu_patch_code_8168ep_1[] = {
8430 0xE008, 0xE0D3, 0xE0D6, 0xE0D9, 0xE0DB, 0xE0DD, 0xE0DF, 0xE0E1, 0xC251,
8431 0x7340, 0x49B1, 0xF010, 0x1D02, 0x8D40, 0xC202, 0xBA00, 0x2C3A, 0xC0F0,
8432 0xE8DE, 0x2000, 0x8000, 0xC0B6, 0x268C, 0x752C, 0x49D4, 0xF112, 0xE025,
8433 0xC2F6, 0x7146, 0xC2F5, 0x7340, 0x49BE, 0xF103, 0xC7F2, 0xE002, 0xC7F1,
8434 0x304F, 0x6226, 0x49A1, 0xF1F0, 0x7222, 0x49A0, 0xF1ED, 0x2525, 0x1F28,
8435 0x3097, 0x3091, 0x9A36, 0x752C, 0x21DC, 0x25BC, 0xC6E2, 0x77C0, 0x1304,
8436 0xF014, 0x1303, 0xF014, 0x1302, 0xF014, 0x1301, 0xF014, 0x49D4, 0xF103,
8437 0xC3D7, 0xBB00, 0xC618, 0x67C6, 0x752E, 0x22D7, 0x26DD, 0x1505, 0xF013,
8438 0xC60A, 0xBE00, 0xC309, 0xBB00, 0xC308, 0xBB00, 0xC307, 0xBB00, 0xC306,
8439 0xBB00, 0x25C8, 0x25A6, 0x25AC, 0x25B2, 0x25B8, 0xCD08, 0x0000, 0xC0BC,
8440 0xC2FF, 0x7340, 0x49B0, 0xF04E, 0x1F46, 0x308F, 0xC3F7, 0x1C04, 0xE84D,
8441 0x1401, 0xF147, 0x7226, 0x49A7, 0xF044, 0x7222, 0x2525, 0x1F30, 0x3097,
8442 0x3091, 0x7340, 0xC4EA, 0x401C, 0xF006, 0xC6E8, 0x75C0, 0x49D7, 0xF105,
8443 0xE036, 0x1D08, 0x8DC1, 0x0208, 0x6640, 0x2764, 0x1606, 0xF12F, 0x6346,
8444 0x133B, 0xF12C, 0x9B34, 0x1B18, 0x3093, 0xC32A, 0x1C10, 0xE82A, 0x1401,
8445 0xF124, 0x1A36, 0x308A, 0x7322, 0x25B5, 0x0B0E, 0x1C00, 0xE82C, 0xC71F,
8446 0x4027, 0xF11A, 0xE838, 0x1F42, 0x308F, 0x1B08, 0xE824, 0x7236, 0x7746,
8447 0x1700, 0xF00D, 0xC313, 0x401F, 0xF103, 0x1F00, 0x9F46, 0x7744, 0x449F,
8448 0x445F, 0xE817, 0xC70A, 0x4027, 0xF105, 0xC302, 0xBB00, 0x2E08, 0x2DC2,
8449 0xC7FF, 0xBF00, 0xCDB8, 0xFFFF, 0x0C02, 0xA554, 0xA5DC, 0x402F, 0xF105,
8450 0x1400, 0xF1FA, 0x1C01, 0xE002, 0x1C00, 0xFF80, 0x49B0, 0xF004, 0x0B01,
8451 0xA1D3, 0xE003, 0x0B02, 0xA5D3, 0x3127, 0x3720, 0x0B02, 0xA5D3, 0x3127,
8452 0x3720, 0x1300, 0xF1FB, 0xFF80, 0x7322, 0x25B5, 0x1E28, 0x30DE, 0x30D9,
8453 0x7264, 0x1E11, 0x2368, 0x3116, 0xFF80, 0x1B7E, 0xC602, 0xBE00, 0x06A6,
8454 0x1B7E, 0xC602, 0xBE00, 0x0764, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00,
8455 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00,
8456 0x0000
8457 };
8458
8459 rtl8168_hw_disable_mac_mcu_bps(dev);
8460
8461 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168ep_1); i++) {
8462 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168ep_1[i]);
8463 }
8464
8465 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8466
8467 rtl8168_mac_ocp_write(tp, 0xFC28, 0x2549);
8468 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x06A5);
8469 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0763);
8470 }
8471
8472 static void
rtl8168_set_mac_mcu_8168ep_2(struct net_device * dev)8473 rtl8168_set_mac_mcu_8168ep_2(struct net_device *dev)
8474 {
8475 struct rtl8168_private *tp = netdev_priv(dev);
8476 u16 i;
8477 static const u16 mcu_patch_code_8168ep_2[] = {
8478 0xE008, 0xE017, 0xE052, 0xE056, 0xE058, 0xE05A, 0xE05C, 0xE05E, 0xC50F,
8479 0x76A4, 0x49E3, 0xF007, 0x49C0, 0xF103, 0xC607, 0xBE00, 0xC606, 0xBE00,
8480 0xC602, 0xBE00, 0x0BDA, 0x0BB6, 0x0BBA, 0xDC00, 0xB400, 0xB401, 0xB402,
8481 0xB403, 0xB404, 0xC02E, 0x7206, 0x49AE, 0xF1FE, 0xC12B, 0x9904, 0xC12A,
8482 0x9906, 0x7206, 0x49AE, 0xF1FE, 0x7200, 0x49A0, 0xF117, 0xC123, 0xC223,
8483 0xC323, 0xE808, 0xC322, 0xE806, 0xC321, 0xE804, 0xC320, 0xE802, 0xE00C,
8484 0x740E, 0x49CE, 0xF1FE, 0x9908, 0x990A, 0x9A0C, 0x9B0E, 0x740E, 0x49CE,
8485 0xF1FE, 0xFF80, 0xB004, 0xB003, 0xB002, 0xB001, 0xB000, 0xC604, 0xC002,
8486 0xB800, 0x1FC8, 0xE000, 0xE8E0, 0xF128, 0x0002, 0xFFFF, 0xF000, 0x8001,
8487 0x8002, 0x8003, 0x8004, 0x48C1, 0x48C2, 0xC502, 0xBD00, 0x0490, 0xC602,
8488 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602,
8489 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000,
8490 };
8491
8492 rtl8168_hw_disable_mac_mcu_bps(dev);
8493
8494 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168ep_2); i++) {
8495 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168ep_2[i]);
8496 }
8497
8498 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8499
8500 rtl8168_mac_ocp_write(tp, 0xFC28, 0x0BB3);
8501 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x1FC7);
8502 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0485);
8503 }
8504
8505 static void
rtl8168_set_mac_mcu_8168h_1(struct net_device * dev)8506 rtl8168_set_mac_mcu_8168h_1(struct net_device *dev)
8507 {
8508 struct rtl8168_private *tp = netdev_priv(dev);
8509 u16 i;
8510 static const u16 mcu_patch_code_8168h_1[] = {
8511 0xE008, 0xE00F, 0xE011, 0xE047, 0xE049, 0xE073, 0xE075, 0xE079, 0xC707,
8512 0x1D00, 0x8DE2, 0x48C1, 0xC502, 0xBD00, 0x00E4, 0xE0C0, 0xC502, 0xBD00,
8513 0x0216, 0xC634, 0x75C0, 0x49D3, 0xF027, 0xC631, 0x75C0, 0x49D3, 0xF123,
8514 0xC627, 0x75C0, 0xB405, 0xC525, 0x9DC0, 0xC621, 0x75C8, 0x49D5, 0xF00A,
8515 0x49D6, 0xF008, 0x49D7, 0xF006, 0x49D8, 0xF004, 0x75D2, 0x49D9, 0xF111,
8516 0xC517, 0x9DC8, 0xC516, 0x9DD2, 0xC618, 0x75C0, 0x49D4, 0xF003, 0x49D0,
8517 0xF104, 0xC60A, 0xC50E, 0x9DC0, 0xB005, 0xC607, 0x9DC0, 0xB007, 0xC602,
8518 0xBE00, 0x1A06, 0xB400, 0xE86C, 0xA000, 0x01E1, 0x0200, 0x9200, 0xE84C,
8519 0xE004, 0xE908, 0xC502, 0xBD00, 0x0B58, 0xB407, 0xB404, 0x2195, 0x25BD,
8520 0x9BE0, 0x1C1C, 0x484F, 0x9CE2, 0x72E2, 0x49AE, 0xF1FE, 0x0B00, 0xF116,
8521 0xC71C, 0xC419, 0x9CE0, 0x1C13, 0x484F, 0x9CE2, 0x74E2, 0x49CE, 0xF1FE,
8522 0xC412, 0x9CE0, 0x1C13, 0x484F, 0x9CE2, 0x74E2, 0x49CE, 0xF1FE, 0xC70C,
8523 0x74F8, 0x48C3, 0x8CF8, 0xB004, 0xB007, 0xC502, 0xBD00, 0x0F24, 0x0481,
8524 0x0C81, 0xDE24, 0xE000, 0xC602, 0xBE00, 0x0CA4, 0x48C1, 0x48C2, 0xC502,
8525 0xBD00, 0x0578, 0xC602, 0xBE00, 0x0000
8526 };
8527
8528 rtl8168_hw_disable_mac_mcu_bps(dev);
8529
8530 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168h_1); i++) {
8531 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168h_1[i]);
8532 }
8533
8534 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8535
8536 rtl8168_mac_ocp_write(tp, 0xFC28, 0x00E2);
8537 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0210);
8538 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x1A04);
8539 rtl8168_mac_ocp_write(tp, 0xFC2E, 0x0B26);
8540 rtl8168_mac_ocp_write(tp, 0xFC30, 0x0F02);
8541 rtl8168_mac_ocp_write(tp, 0xFC32, 0x0CA0);
8542 rtl8168_mac_ocp_write(tp, 0xFC34, 0x056C);
8543
8544 rtl8168_mac_ocp_write(tp, 0xFC38, 0x007F);
8545 }
8546
8547 static void
rtl8168_set_mac_mcu_8168fp_1(struct net_device * dev)8548 rtl8168_set_mac_mcu_8168fp_1(struct net_device *dev)
8549 {
8550 struct rtl8168_private *tp = netdev_priv(dev);
8551 u16 i;
8552 u16 breakPointEnabled = 0;
8553
8554 rtl8168_hw_disable_mac_mcu_bps(dev);
8555
8556 if(tp->HwPkgDet == 0x00 || tp->HwPkgDet == 0x0F) {
8557 static const u16 mcu_patch_code_8168fp_1_1[] = {
8558 0xE00A, 0xE0C1, 0xE104, 0xE108, 0xE10D, 0xE112, 0xE11C, 0xE121, 0xE000,
8559 0xE0C8, 0xB400, 0xC1FE, 0x49E2, 0xF04C, 0x49EA, 0xF04A, 0x74E6, 0xC246,
8560 0x7542, 0x73EC, 0x1800, 0x49C0, 0xF10D, 0x49C1, 0xF10B, 0x49C2, 0xF109,
8561 0x49B0, 0xF107, 0x49B1, 0xF105, 0x7220, 0x49A2, 0xF102, 0xE002, 0x4800,
8562 0x49D0, 0xF10A, 0x49D1, 0xF108, 0x49D2, 0xF106, 0x49D3, 0xF104, 0x49DF,
8563 0xF102, 0xE00C, 0x4801, 0x72E4, 0x49AD, 0xF108, 0xC225, 0x6741, 0x48F0,
8564 0x8F41, 0x4870, 0x8F41, 0xC7CF, 0x49B5, 0xF01F, 0x49B2, 0xF00B, 0x4980,
8565 0xF003, 0x484E, 0x94E7, 0x4981, 0xF004, 0x485E, 0xC212, 0x9543, 0xE071,
8566 0x49B6, 0xF003, 0x49B3, 0xF10F, 0x4980, 0xF003, 0x484E, 0x94E7, 0x4981,
8567 0xF004, 0x485E, 0xC204, 0x9543, 0xE005, 0xE000, 0xE0FC, 0xE0FA, 0xE065,
8568 0x49B7, 0xF007, 0x4980, 0xF005, 0x1A38, 0x46D4, 0x1200, 0xF109, 0x4981,
8569 0xF055, 0x49C3, 0xF105, 0x1A30, 0x46D5, 0x1200, 0xF04F, 0x7220, 0x49A2,
8570 0xF130, 0x49C1, 0xF12E, 0x49B0, 0xF12C, 0xC2E6, 0x7240, 0x49A8, 0xF003,
8571 0x49D0, 0xF126, 0x49A9, 0xF003, 0x49D1, 0xF122, 0x49AA, 0xF003, 0x49D2,
8572 0xF11E, 0x49AB, 0xF003, 0x49DF, 0xF11A, 0x49AC, 0xF003, 0x49D3, 0xF116,
8573 0x4980, 0xF003, 0x49C7, 0xF105, 0x4981, 0xF02C, 0x49D7, 0xF02A, 0x49C0,
8574 0xF00C, 0xC721, 0x62F4, 0x49A0, 0xF008, 0x49A4, 0xF106, 0x4824, 0x8AF4,
8575 0xC71A, 0x1A40, 0x9AE0, 0x49B6, 0xF017, 0x200E, 0xC7B8, 0x72E0, 0x4710,
8576 0x92E1, 0xC70E, 0x77E0, 0x49F0, 0xF112, 0xC70B, 0x77E0, 0x27FE, 0x1AFA,
8577 0x4317, 0xC705, 0x9AE2, 0x1A11, 0x8AE0, 0xE008, 0xE41C, 0xC0AE, 0xD23A,
8578 0xC7A2, 0x74E6, 0x484F, 0x94E7, 0xC79E, 0x8CE6, 0x8BEC, 0xC29C, 0x8D42,
8579 0x7220, 0xB000, 0xC502, 0xBD00, 0x0932, 0xB400, 0xC240, 0xC340, 0x7060,
8580 0x498F, 0xF014, 0x488F, 0x9061, 0x744C, 0x49C3, 0xF004, 0x7562, 0x485E,
8581 0x9563, 0x7446, 0x49C3, 0xF106, 0x7562, 0x1C30, 0x46E5, 0x1200, 0xF004,
8582 0x7446, 0x484F, 0x9447, 0xC32A, 0x7466, 0x49C0, 0xF00F, 0x48C0, 0x9C66,
8583 0x7446, 0x4840, 0x4841, 0x4842, 0x9C46, 0x744C, 0x4840, 0x9C4C, 0x744A,
8584 0x484A, 0x9C4A, 0xE013, 0x498E, 0xF011, 0x488E, 0x9061, 0x744C, 0x49C3,
8585 0xF004, 0x7446, 0x484E, 0x9447, 0x7446, 0x1D38, 0x46EC, 0x1500, 0xF004,
8586 0x7446, 0x484F, 0x9447, 0xB000, 0xC502, 0xBD00, 0x074C, 0xE000, 0xE0FC,
8587 0xE0C0, 0x4830, 0x4837, 0xC502, 0xBD00, 0x0978, 0x63E2, 0x4830, 0x4837,
8588 0xC502, 0xBD00, 0x09FE, 0x73E2, 0x4830, 0x8BE2, 0xC302, 0xBB00, 0x0A12,
8589 0x73E2, 0x48B0, 0x48B3, 0x48B4, 0x48B5, 0x48B6, 0x48B7, 0x8BE2, 0xC302,
8590 0xBB00, 0x0A5A, 0x73E2, 0x4830, 0x8BE2, 0xC302, 0xBB00, 0x0A6C, 0x73E2,
8591 0x4830, 0x4837, 0xC502, 0xBD00, 0x0A86
8592 };
8593
8594 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_1_1); i++) {
8595 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_1_1[i]);
8596 }
8597
8598 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8599
8600 rtl8168_mac_ocp_write(tp, 0xFC28, 0x0890);
8601 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0712);
8602 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0974);
8603 rtl8168_mac_ocp_write(tp, 0xFC2E, 0x09FC);
8604 rtl8168_mac_ocp_write(tp, 0xFC30, 0x0A0E);
8605 rtl8168_mac_ocp_write(tp, 0xFC32, 0x0A56);
8606 rtl8168_mac_ocp_write(tp, 0xFC34, 0x0A68);
8607 rtl8168_mac_ocp_write(tp, 0xFC36, 0x0A84);
8608
8609 } else if (tp->HwPkgDet == 0x6) {
8610 static const u16 mcu_patch_code_8168fp_1_2[] = {
8611 0xE008, 0xE00A, 0xE031, 0xE033, 0xE035, 0xE144, 0xE166, 0xE168, 0xC502,
8612 0xBD00, 0x0000, 0xC725, 0x75E0, 0x48D0, 0x9DE0, 0xC722, 0x75E0, 0x1C78,
8613 0x416C, 0x1530, 0xF111, 0xC71D, 0x75F6, 0x49D1, 0xF00D, 0x75E0, 0x1C1F,
8614 0x416C, 0x1502, 0xF108, 0x75FA, 0x49D3, 0xF005, 0x75EC, 0x9DE4, 0x4853,
8615 0x9DFA, 0xC70B, 0x75E0, 0x4852, 0x4850, 0x9DE0, 0xC602, 0xBE00, 0x04B8,
8616 0xE420, 0xE000, 0xE0FC, 0xE43C, 0xDC00, 0xEB00, 0xC202, 0xBA00, 0x0000,
8617 0xC002, 0xB800, 0x0000, 0xB401, 0xB402, 0xB403, 0xB404, 0xB405, 0xB406,
8618 0xC44D, 0xC54D, 0x1867, 0xE8A2, 0x2318, 0x276E, 0x1601, 0xF106, 0x1A07,
8619 0xE861, 0xE86B, 0xE873, 0xE037, 0x231E, 0x276E, 0x1602, 0xF10B, 0x1A07,
8620 0xE858, 0xE862, 0xC247, 0xC344, 0xE8E3, 0xC73B, 0x66E0, 0xE8B5, 0xE029,
8621 0x231A, 0x276C, 0xC733, 0x9EE0, 0x1866, 0xE885, 0x251C, 0x120F, 0xF011,
8622 0x1209, 0xF011, 0x2014, 0x240E, 0x1000, 0xF007, 0x120C, 0xF00D, 0x1203,
8623 0xF00D, 0x1200, 0xF00D, 0x120C, 0xF00D, 0x1203, 0xF00D, 0x1A03, 0xE00C,
8624 0x1A07, 0xE00A, 0x1A00, 0xE008, 0x1A01, 0xE006, 0x1A02, 0xE004, 0x1A04,
8625 0xE002, 0x1A05, 0xE829, 0xE833, 0xB006, 0xB005, 0xB004, 0xB003, 0xB002,
8626 0xB001, 0x60C4, 0xC702, 0xBF00, 0x2786, 0xDD00, 0xD030, 0xE0C4, 0xE0F8,
8627 0xDC42, 0xD3F0, 0x0000, 0x0004, 0x0007, 0x0014, 0x0090, 0x1000, 0x0F00,
8628 0x1004, 0x1008, 0x3000, 0x3004, 0x3008, 0x4000, 0x7777, 0x8000, 0x8001,
8629 0x8008, 0x8003, 0x8004, 0xC000, 0xC004, 0xF004, 0xFFFF, 0xB406, 0xB407,
8630 0xC6E5, 0x77C0, 0x27F3, 0x23F3, 0x47FA, 0x9FC0, 0xB007, 0xB006, 0xFF80,
8631 0xB405, 0xB407, 0xC7D8, 0x75E0, 0x48D0, 0x9DE0, 0xB007, 0xB005, 0xFF80,
8632 0xB401, 0xC0EA, 0xC2DC, 0xC3D8, 0xE865, 0xC0D3, 0xC1E0, 0xC2E3, 0xE861,
8633 0xE817, 0xC0CD, 0xC2CF, 0xE85D, 0xC0C9, 0xC1D6, 0xC2DB, 0xE859, 0xE80F,
8634 0xC1C7, 0xC2CE, 0xE855, 0xC0C0, 0xC1D1, 0xC2D3, 0xE851, 0xE807, 0xC0BE,
8635 0xC2C2, 0xE84D, 0xE803, 0xB001, 0xFF80, 0xB402, 0xC2C6, 0xE859, 0x499F,
8636 0xF1FE, 0xB002, 0xFF80, 0xB402, 0xB403, 0xB407, 0xE821, 0x8882, 0x1980,
8637 0x8983, 0xE81D, 0x7180, 0x218B, 0x25BB, 0x1310, 0xF014, 0x1310, 0xFB03,
8638 0x1F20, 0x38FB, 0x3288, 0x434B, 0x2491, 0x430B, 0x1F0F, 0x38FB, 0x4313,
8639 0x2121, 0x4353, 0x2521, 0x418A, 0x6282, 0x2527, 0x212F, 0x418A, 0xB007,
8640 0xB003, 0xB002, 0xFF80, 0x6183, 0x2496, 0x1100, 0xF1FD, 0xFF80, 0x4800,
8641 0x4801, 0xC213, 0xC313, 0xE815, 0x4860, 0x8EE0, 0xC210, 0xC310, 0xE822,
8642 0x481E, 0xC20C, 0xC30C, 0xE80C, 0xC206, 0x7358, 0x483A, 0x9B58, 0xFF80,
8643 0xE8E0, 0xE000, 0x1008, 0x0F00, 0x800C, 0x0F00, 0xB407, 0xB406, 0xB403,
8644 0xC7F7, 0x98E0, 0x99E2, 0x9AE4, 0x21B2, 0x4831, 0x483F, 0x9BE6, 0x66E7,
8645 0x49E6, 0xF1FE, 0xB003, 0xB006, 0xB007, 0xFF80, 0xB407, 0xB406, 0xB403,
8646 0xC7E5, 0x9AE4, 0x21B2, 0x4831, 0x9BE6, 0x66E7, 0x49E6, 0xF1FE, 0x70E0,
8647 0x71E2, 0xB003, 0xB006, 0xB007, 0xFF80, 0x4882, 0xB406, 0xB405, 0xC71E,
8648 0x76E0, 0x1D78, 0x4175, 0x1630, 0xF10C, 0xC715, 0x76E0, 0x4861, 0x9EE0,
8649 0xC713, 0x1EFF, 0x9EE2, 0x75E0, 0x4850, 0x9DE0, 0xE005, 0xC70B, 0x76E0,
8650 0x4865, 0x9EE0, 0xB005, 0xB006, 0xC708, 0xC102, 0xB900, 0x279E, 0xEB16,
8651 0xEB00, 0xE43C, 0xDC00, 0xD3EC, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00,
8652 0x0000
8653 };
8654
8655 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_1_2); i++) {
8656 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_1_2[i]);
8657 }
8658
8659 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8660
8661 rtl8168_mac_ocp_write(tp, 0xFC28, 0x0000);
8662 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x04b4);
8663 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0000);
8664 rtl8168_mac_ocp_write(tp, 0xFC2E, 0x0000);
8665 rtl8168_mac_ocp_write(tp, 0xFC30, 0x0000);
8666 rtl8168_mac_ocp_write(tp, 0xFC32, 0x279C);
8667 rtl8168_mac_ocp_write(tp, 0xFC34, 0x0000);
8668 rtl8168_mac_ocp_write(tp, 0xFC36, 0x0000);
8669 }
8670
8671 if (tp->HwPkgDet == 0x00)
8672 breakPointEnabled = 0x00FC;
8673 else if (tp->HwPkgDet == 0x0F)
8674 breakPointEnabled = 0x00FF;
8675 else if (tp->HwPkgDet == 0x06)
8676 breakPointEnabled = 0x0022;
8677
8678 rtl8168_mac_ocp_write(tp, 0xFC38, breakPointEnabled);
8679 }
8680
8681 static void
rtl8168_set_mac_mcu_8168fp_2(struct net_device * dev)8682 rtl8168_set_mac_mcu_8168fp_2(struct net_device *dev)
8683 {
8684 struct rtl8168_private *tp = netdev_priv(dev);
8685 u16 i;
8686 static const u16 mcu_patch_code_8168fp_2[] = {
8687 0xE008, 0xE00A, 0xE00F, 0xE014, 0xE05F, 0xE063, 0xE065, 0xE067, 0xC602,
8688 0xBE00, 0x2AB2, 0x1BC0, 0x46EB, 0x1BFE, 0xC102, 0xB900, 0x0B1A, 0x1BC0,
8689 0x46EB, 0x1B7E, 0xC102, 0xB900, 0x0BEA, 0xB400, 0xB401, 0xB402, 0xB403,
8690 0xB404, 0xB405, 0xC03A, 0x7206, 0x49AE, 0xF1FE, 0xC137, 0x9904, 0xC136,
8691 0x9906, 0x7206, 0x49AE, 0xF1FE, 0x7200, 0x49A0, 0xF10B, 0xC52F, 0xC12E,
8692 0xC232, 0xC332, 0xE812, 0xC331, 0xE810, 0xC330, 0xE80E, 0xE018, 0xC126,
8693 0xC229, 0xC525, 0xC328, 0xE808, 0xC523, 0xC326, 0xE805, 0xC521, 0xC324,
8694 0xE802, 0xE00C, 0x740E, 0x49CE, 0xF1FE, 0x9908, 0x9D0A, 0x9A0C, 0x9B0E,
8695 0x740E, 0x49CE, 0xF1FE, 0xFF80, 0xB005, 0xB004, 0xB003, 0xB002, 0xB001,
8696 0xB000, 0xC604, 0xC002, 0xB800, 0x2A5E, 0xE000, 0xE8E0, 0xF128, 0x3DC2,
8697 0xFFFF, 0x10EC, 0x816A, 0x816D, 0x816C, 0xF000, 0x8002, 0x8004, 0x8007,
8698 0x48C1, 0x48C2, 0xC502, 0xBD00, 0x07BC, 0xC602, 0xBE00, 0x0000, 0xC602,
8699 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000
8700 };
8701
8702 rtl8168_hw_disable_mac_mcu_bps(dev);
8703
8704 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_2); i++) {
8705 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_2[i]);
8706 }
8707
8708 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8709
8710 rtl8168_mac_ocp_write(tp, 0xFC28, 0x2AAC);
8711 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0B14);
8712 rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0BE4);
8713 rtl8168_mac_ocp_write(tp, 0xFC2E, 0x2A5C);
8714 rtl8168_mac_ocp_write(tp, 0xFC30, 0x07B0);
8715
8716 if (tp->HwSuppSerDesPhyVer == 1)
8717 rtl8168_mac_ocp_write(tp, 0xFC38, 0x001F);
8718 else
8719 rtl8168_mac_ocp_write(tp, 0xFC38, 0x001E);
8720
8721 }
8722
8723 static void
rtl8168_set_mac_mcu_8168fp_3(struct net_device * dev)8724 rtl8168_set_mac_mcu_8168fp_3(struct net_device *dev)
8725 {
8726 struct rtl8168_private *tp = netdev_priv(dev);
8727 u16 i;
8728 static const u16 mcu_patch_code_8168fp_3[] = {
8729 0xE008, 0xE053, 0xE057, 0xE059, 0xE05B, 0xE05D, 0xE05F, 0xE061, 0xB400,
8730 0xB401, 0xB402, 0xB403, 0xB404, 0xB405, 0xC03A, 0x7206, 0x49AE, 0xF1FE,
8731 0xC137, 0x9904, 0xC136, 0x9906, 0x7206, 0x49AE, 0xF1FE, 0x7200, 0x49A0,
8732 0xF10B, 0xC52F, 0xC12E, 0xC232, 0xC332, 0xE812, 0xC331, 0xE810, 0xC330,
8733 0xE80E, 0xE018, 0xC126, 0xC229, 0xC525, 0xC328, 0xE808, 0xC523, 0xC326,
8734 0xE805, 0xC521, 0xC324, 0xE802, 0xE00C, 0x740E, 0x49CE, 0xF1FE, 0x9908,
8735 0x9D0A, 0x9A0C, 0x9B0E, 0x740E, 0x49CE, 0xF1FE, 0xFF80, 0xB005, 0xB004,
8736 0xB003, 0xB002, 0xB001, 0xB000, 0xC604, 0xC002, 0xB800, 0x2B16, 0xE000,
8737 0xE8E0, 0xF128, 0x3DC2, 0xFFFF, 0x10EC, 0x816A, 0x816D, 0x816C, 0xF000,
8738 0x8002, 0x8004, 0x8007, 0x48C1, 0x48C2, 0xC502, 0xBD00, 0x07BC, 0xC602,
8739 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602,
8740 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000
8741 };
8742
8743 rtl8168_hw_disable_mac_mcu_bps(dev);
8744
8745 for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_3); i++) {
8746 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_3[i]);
8747 }
8748
8749 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
8750
8751 rtl8168_mac_ocp_write(tp, 0xFC28, 0x2B14);
8752 rtl8168_mac_ocp_write(tp, 0xFC2A, 0x07B0);
8753
8754 rtl8168_mac_ocp_write(tp, 0xFC38, 0x0003);
8755 }
8756
8757 static void
rtl8168_hw_mac_mcu_config(struct net_device * dev)8758 rtl8168_hw_mac_mcu_config(struct net_device *dev)
8759 {
8760 struct rtl8168_private *tp = netdev_priv(dev);
8761
8762 if (tp->NotWrMcuPatchCode == TRUE) return;
8763
8764 switch (tp->mcfg) {
8765 case CFG_METHOD_21:
8766 rtl8168_set_mac_mcu_8168g_1(dev);
8767 break;
8768 case CFG_METHOD_24:
8769 rtl8168_set_mac_mcu_8168gu_1(dev);
8770 break;
8771 case CFG_METHOD_25:
8772 rtl8168_set_mac_mcu_8168gu_2(dev);
8773 break;
8774 case CFG_METHOD_26:
8775 rtl8168_set_mac_mcu_8411b_1(dev);
8776 break;
8777 case CFG_METHOD_27:
8778 rtl8168_set_mac_mcu_8168ep_1(dev);
8779 break;
8780 case CFG_METHOD_28:
8781 rtl8168_set_mac_mcu_8168ep_2(dev);
8782 break;
8783 case CFG_METHOD_29:
8784 case CFG_METHOD_30:
8785 rtl8168_set_mac_mcu_8168h_1(dev);
8786 break;
8787 case CFG_METHOD_31:
8788 rtl8168_set_mac_mcu_8168fp_1(dev);
8789 break;
8790 case CFG_METHOD_32:
8791 rtl8168_set_mac_mcu_8168fp_2(dev);
8792 break;
8793 case CFG_METHOD_33:
8794 rtl8168_set_mac_mcu_8168fp_3(dev);
8795 break;
8796 }
8797 }
8798 #endif
8799
8800 #ifdef ENABLE_USE_FIRMWARE_FILE
rtl8168_release_firmware(struct rtl8168_private * tp)8801 static void rtl8168_release_firmware(struct rtl8168_private *tp)
8802 {
8803 if (tp->rtl_fw) {
8804 rtl8168_fw_release_firmware(tp->rtl_fw);
8805 kfree(tp->rtl_fw);
8806 tp->rtl_fw = NULL;
8807 }
8808 }
8809
rtl8168_apply_firmware(struct rtl8168_private * tp)8810 void rtl8168_apply_firmware(struct rtl8168_private *tp)
8811 {
8812 /* TODO: release firmware if rtl_fw_write_firmware signals failure. */
8813 if (tp->rtl_fw) {
8814 rtl8168_fw_write_firmware(tp, tp->rtl_fw);
8815 /* At least one firmware doesn't reset tp->ocp_base. */
8816 tp->ocp_base = OCP_STD_PHY_BASE;
8817
8818 /* PHY soft reset may still be in progress */
8819 //phy_read_poll_timeout(tp->phydev, MII_BMCR, val,
8820 // !(val & BMCR_RESET),
8821 // 50000, 600000, true);
8822 rtl8168_wait_phy_reset_complete(tp);
8823
8824 tp->hw_ram_code_ver = rtl8168_get_hw_phy_mcu_code_ver(tp);
8825 tp->sw_ram_code_ver = tp->hw_ram_code_ver;
8826 tp->HwHasWrRamCodeToMicroP = TRUE;
8827 }
8828 }
8829 #endif
8830
8831 static void
rtl8168_hw_init(struct net_device * dev)8832 rtl8168_hw_init(struct net_device *dev)
8833 {
8834 struct rtl8168_private *tp = netdev_priv(dev);
8835 u32 csi_tmp;
8836
8837 if (tp->HwSuppAspmClkIntrLock) {
8838 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7);
8839 rtl8168_enable_cfg9346_write(tp);
8840 rtl8168_hw_aspm_clkreq_enable(tp, false);
8841 rtl8168_disable_cfg9346_write(tp);
8842 }
8843
8844 //Disable UPS
8845 if (HW_SUPPORT_UPS_MODE(tp))
8846 rtl8168_mac_ocp_write(tp, 0xD400, rtl8168_mac_ocp_read( tp, 0xD400) & ~(BIT_0));
8847
8848 //Disable DMA Aggregation
8849 switch (tp->mcfg) {
8850 case CFG_METHOD_29:
8851 case CFG_METHOD_30:
8852 case CFG_METHOD_31:
8853 case CFG_METHOD_32:
8854 case CFG_METHOD_33:
8855 rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read( tp, 0xE63E) & ~(BIT_3 | BIT_2 | BIT_1));
8856 rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read( tp, 0xE63E) | (BIT_0));
8857 rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read( tp, 0xE63E) & ~(BIT_0));
8858 rtl8168_mac_ocp_write(tp, 0xC094, 0x0);
8859 rtl8168_mac_ocp_write(tp, 0xC09E, 0x0);
8860 break;
8861 }
8862
8863 switch (tp->mcfg) {
8864 case CFG_METHOD_9:
8865 case CFG_METHOD_10:
8866 RTL_W8(tp, DBG_reg, RTL_R8(tp, DBG_reg) | BIT_1 | BIT_7);
8867 break;
8868 }
8869
8870 switch (tp->mcfg) {
8871 case CFG_METHOD_14:
8872 case CFG_METHOD_15:
8873 case CFG_METHOD_16:
8874 case CFG_METHOD_17:
8875 case CFG_METHOD_18:
8876 case CFG_METHOD_19:
8877 RTL_W8(tp, 0xF2, (RTL_R8(tp, 0xF2) & ~(BIT_2 | BIT_1 | BIT_0)));
8878 break;
8879 }
8880
8881 switch (tp->mcfg) {
8882 case CFG_METHOD_16:
8883 case CFG_METHOD_17:
8884 case CFG_METHOD_18:
8885 case CFG_METHOD_19:
8886 case CFG_METHOD_20:
8887 if (aspm) {
8888 RTL_W8(tp, 0x6E, RTL_R8(tp, 0x6E) | BIT_6);
8889 rtl8168_eri_write(tp, 0x1AE, 2, 0x0403, ERIAR_ExGMAC);
8890 }
8891 break;
8892 case CFG_METHOD_21:
8893 case CFG_METHOD_22:
8894 case CFG_METHOD_29:
8895 case CFG_METHOD_30:
8896 if (aspm) {
8897 if ((rtl8168_mac_ocp_read(tp, 0xDC00) & BIT_3) || (RTL_R8(tp, Config0) & 0x07)) {
8898 RTL_W8(tp, 0x6E, RTL_R8(tp, 0x6E) | BIT_6);
8899 rtl8168_eri_write(tp, 0x1AE, 2, 0x0403, ERIAR_ExGMAC);
8900 }
8901 }
8902 break;
8903 }
8904
8905 if (tp->mcfg == CFG_METHOD_10 || tp->mcfg == CFG_METHOD_14 || tp->mcfg == CFG_METHOD_15)
8906 RTL_W8(tp, 0xF3, RTL_R8(tp, 0xF3) | BIT_2);
8907
8908 #ifndef ENABLE_USE_FIRMWARE_FILE
8909 if (!tp->rtl_fw)
8910 rtl8168_hw_mac_mcu_config(dev);
8911 #endif
8912
8913 /*disable ocp phy power saving*/
8914 if (tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
8915 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
8916 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
8917 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
8918 tp->mcfg == CFG_METHOD_33)
8919 if (!tp->dash_printer_enabled)
8920 rtl8168_disable_ocp_phy_power_saving(dev);
8921
8922 //Set PCIE uncorrectable error status mask pcie 0x108
8923 csi_tmp = rtl8168_csi_read(tp, 0x108);
8924 csi_tmp |= BIT_20;
8925 rtl8168_csi_write(tp, 0x108, csi_tmp);
8926
8927 switch (tp->mcfg) {
8928 case CFG_METHOD_21:
8929 case CFG_METHOD_22:
8930 case CFG_METHOD_23:
8931 case CFG_METHOD_24:
8932 csi_tmp = rtl8168_eri_read(tp, 0x1AB, 1, ERIAR_ExGMAC);
8933 csi_tmp |= ( BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7 );
8934 rtl8168_eri_write(tp, 0x1AB, 1, csi_tmp, ERIAR_ExGMAC);
8935 break;
8936 }
8937
8938 rtl8168_set_pci_pme(tp, 0);
8939
8940 if (s0_magic_packet == 1)
8941 rtl8168_enable_magic_packet(dev);
8942
8943 #ifdef ENABLE_USE_FIRMWARE_FILE
8944 if (tp->rtl_fw &&
8945 !(HW_DASH_SUPPORT_TYPE_3(tp) &&
8946 tp->HwPkgDet == 0x06))
8947 rtl8168_apply_firmware(tp);
8948 #endif
8949 }
8950
8951 static void
rtl8168_hw_ephy_config(struct net_device * dev)8952 rtl8168_hw_ephy_config(struct net_device *dev)
8953 {
8954 struct rtl8168_private *tp = netdev_priv(dev);
8955 u16 ephy_data;
8956
8957 switch (tp->mcfg) {
8958 case CFG_METHOD_4:
8959 /*Set EPHY registers begin*/
8960 /*Set EPHY register offset 0x02 bit 11 to 0 and bit 12 to 1*/
8961 ephy_data = rtl8168_ephy_read(tp, 0x02);
8962 ephy_data &= ~BIT_11;
8963 ephy_data |= BIT_12;
8964 rtl8168_ephy_write(tp, 0x02, ephy_data);
8965
8966 /*Set EPHY register offset 0x03 bit 1 to 1*/
8967 ephy_data = rtl8168_ephy_read(tp, 0x03);
8968 ephy_data |= (1 << 1);
8969 rtl8168_ephy_write(tp, 0x03, ephy_data);
8970
8971 /*Set EPHY register offset 0x06 bit 7 to 0*/
8972 ephy_data = rtl8168_ephy_read(tp, 0x06);
8973 ephy_data &= ~(1 << 7);
8974 rtl8168_ephy_write(tp, 0x06, ephy_data);
8975 /*Set EPHY registers end*/
8976
8977 break;
8978 case CFG_METHOD_5:
8979 /* set EPHY registers */
8980 SetPCIePhyBit(tp, 0x01, BIT_0);
8981
8982 ClearAndSetPCIePhyBit(tp,
8983 0x03,
8984 BIT_10,
8985 BIT_5
8986 );
8987
8988 break;
8989 case CFG_METHOD_9:
8990 /* set EPHY registers */
8991 rtl8168_ephy_write(tp, 0x01, 0x7C7F);
8992 rtl8168_ephy_write(tp, 0x02, 0x011F);
8993 if (tp->eeprom_type != EEPROM_TYPE_NONE) {
8994 ClearAndSetPCIePhyBit(tp,
8995 0x03,
8996 0xFFB0,
8997 0x05B0
8998 );
8999 } else {
9000 ClearAndSetPCIePhyBit(tp,
9001 0x03,
9002 0xFFF0,
9003 0x05F0
9004 );
9005 }
9006 rtl8168_ephy_write(tp, 0x06, 0xB271);
9007 rtl8168_ephy_write(tp, 0x07, 0xCE00);
9008
9009 break;
9010 case CFG_METHOD_10:
9011 /* set EPHY registers */
9012 rtl8168_ephy_write(tp, 0x01, 0x6C7F);
9013 rtl8168_ephy_write(tp, 0x02, 0x011F);
9014 ClearAndSetPCIePhyBit(tp,
9015 0x03,
9016 0xFFF0,
9017 0x01B0
9018 );
9019 rtl8168_ephy_write(tp, 0x1A, 0x0546);
9020 rtl8168_ephy_write(tp, 0x1C, 0x80C4);
9021 rtl8168_ephy_write(tp, 0x1D, 0x78E5);
9022 rtl8168_ephy_write(tp, 0x0A, 0x8100);
9023
9024 break;
9025 case CFG_METHOD_12:
9026 case CFG_METHOD_13:
9027 ephy_data = rtl8168_ephy_read(tp, 0x0B);
9028 rtl8168_ephy_write(tp, 0x0B, ephy_data|0x48);
9029 ephy_data = rtl8168_ephy_read(tp, 0x19);
9030 ephy_data &= ~0x20;
9031 rtl8168_ephy_write(tp, 0x19, ephy_data|0x50);
9032 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9033 ephy_data &= ~0x100;
9034 rtl8168_ephy_write(tp, 0x0C, ephy_data|0x20);
9035 ephy_data = rtl8168_ephy_read(tp, 0x10);
9036 ephy_data &= ~0x04;
9037 rtl8168_ephy_write(tp, 0x10, ephy_data);
9038
9039 break;
9040 case CFG_METHOD_14:
9041 case CFG_METHOD_15:
9042 /* set EPHY registers */
9043 ephy_data = rtl8168_ephy_read(tp, 0x00) & ~0x0200;
9044 ephy_data |= 0x0100;
9045 rtl8168_ephy_write(tp, 0x00, ephy_data);
9046
9047 ephy_data = rtl8168_ephy_read(tp, 0x00);
9048 ephy_data |= 0x0004;
9049 rtl8168_ephy_write(tp, 0x00, ephy_data);
9050
9051 ephy_data = rtl8168_ephy_read(tp, 0x06) & ~0x0002;
9052 ephy_data |= 0x0001;
9053 rtl8168_ephy_write(tp, 0x06, ephy_data);
9054
9055 ephy_data = rtl8168_ephy_read(tp, 0x06);
9056 ephy_data |= 0x0030;
9057 rtl8168_ephy_write(tp, 0x06, ephy_data);
9058
9059 ephy_data = rtl8168_ephy_read(tp, 0x07);
9060 ephy_data |= 0x2000;
9061 rtl8168_ephy_write(tp, 0x07, ephy_data);
9062
9063 ephy_data = rtl8168_ephy_read(tp, 0x00);
9064 ephy_data |= 0x0020;
9065 rtl8168_ephy_write(tp, 0x00, ephy_data);
9066
9067 ephy_data = rtl8168_ephy_read(tp, 0x03) & ~0x5800;
9068 ephy_data |= 0x2000;
9069 rtl8168_ephy_write(tp, 0x03, ephy_data);
9070
9071 ephy_data = rtl8168_ephy_read(tp, 0x03);
9072 ephy_data |= 0x0001;
9073 rtl8168_ephy_write(tp, 0x03, ephy_data);
9074
9075 ephy_data = rtl8168_ephy_read(tp, 0x01) & ~0x0800;
9076 ephy_data |= 0x1000;
9077 rtl8168_ephy_write(tp, 0x01, ephy_data);
9078
9079 ephy_data = rtl8168_ephy_read(tp, 0x07);
9080 ephy_data |= 0x4000;
9081 rtl8168_ephy_write(tp, 0x07, ephy_data);
9082
9083 ephy_data = rtl8168_ephy_read(tp, 0x1E);
9084 ephy_data |= 0x2000;
9085 rtl8168_ephy_write(tp, 0x1E, ephy_data);
9086
9087 rtl8168_ephy_write(tp, 0x19, 0xFE6C);
9088
9089 ephy_data = rtl8168_ephy_read(tp, 0x0A);
9090 ephy_data |= 0x0040;
9091 rtl8168_ephy_write(tp, 0x0A, ephy_data);
9092
9093 break;
9094 case CFG_METHOD_16:
9095 case CFG_METHOD_17:
9096 if (tp->mcfg == CFG_METHOD_16) {
9097 rtl8168_ephy_write(tp, 0x06, 0xF020);
9098 rtl8168_ephy_write(tp, 0x07, 0x01FF);
9099 rtl8168_ephy_write(tp, 0x00, 0x5027);
9100 rtl8168_ephy_write(tp, 0x01, 0x0003);
9101 rtl8168_ephy_write(tp, 0x02, 0x2D16);
9102 rtl8168_ephy_write(tp, 0x03, 0x6D49);
9103 rtl8168_ephy_write(tp, 0x08, 0x0006);
9104 rtl8168_ephy_write(tp, 0x0A, 0x00C8);
9105 }
9106
9107 ephy_data = rtl8168_ephy_read(tp, 0x09);
9108 ephy_data |= BIT_7;
9109 rtl8168_ephy_write(tp, 0x09, ephy_data);
9110
9111 ephy_data = rtl8168_ephy_read(tp, 0x19);
9112 ephy_data |= (BIT_2 | BIT_5 | BIT_9);
9113 rtl8168_ephy_write(tp, 0x19, ephy_data);
9114
9115 ephy_data = rtl8168_ephy_read(tp, 0x00);
9116 ephy_data |= BIT_3;
9117 rtl8168_ephy_write(tp, 0x00, ephy_data);
9118 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9119 ephy_data &= ~(BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4);
9120 ephy_data |= BIT_9;
9121 rtl8168_ephy_write(tp, 0x0C, ephy_data);
9122
9123 break;
9124 case CFG_METHOD_18:
9125 case CFG_METHOD_19:
9126 if (tp->mcfg == CFG_METHOD_18) {
9127 ephy_data = rtl8168_ephy_read(tp, 0x06);
9128 ephy_data |= BIT_5;
9129 ephy_data &= ~(BIT_7 | BIT_6);
9130 rtl8168_ephy_write(tp, 0x06, ephy_data);
9131
9132 ephy_data = rtl8168_ephy_read(tp, 0x08);
9133 ephy_data |= BIT_1;
9134 ephy_data &= ~BIT_0;
9135 rtl8168_ephy_write(tp, 0x08, ephy_data);
9136 }
9137
9138 ephy_data = rtl8168_ephy_read(tp, 0x09);
9139 ephy_data |= BIT_7;
9140 rtl8168_ephy_write(tp, 0x09, ephy_data);
9141
9142 ephy_data = rtl8168_ephy_read(tp, 0x19);
9143 ephy_data |= (BIT_2 | BIT_5 | BIT_9);
9144 rtl8168_ephy_write(tp, 0x19, ephy_data);
9145
9146 ephy_data = rtl8168_ephy_read(tp, 0x00);
9147 ephy_data |= BIT_3;
9148 rtl8168_ephy_write(tp, 0x00, ephy_data);
9149 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9150 ephy_data &= ~(BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4);
9151 ephy_data |= BIT_9;
9152 rtl8168_ephy_write(tp, 0x0C, ephy_data);
9153
9154 break;
9155 case CFG_METHOD_20:
9156 ephy_data = rtl8168_ephy_read(tp, 0x06);
9157 ephy_data |= BIT_5;
9158 ephy_data &= ~(BIT_7 | BIT_6);
9159 rtl8168_ephy_write(tp, 0x06, ephy_data);
9160
9161 rtl8168_ephy_write(tp, 0x0f, 0x5200);
9162
9163 ephy_data = rtl8168_ephy_read(tp, 0x19);
9164 ephy_data |= (BIT_2 | BIT_5 | BIT_9);
9165 rtl8168_ephy_write(tp, 0x19, ephy_data);
9166
9167 ephy_data = rtl8168_ephy_read(tp, 0x00);
9168 ephy_data |= BIT_3;
9169 rtl8168_ephy_write(tp, 0x00, ephy_data);
9170 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9171 ephy_data &= ~(BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4);
9172 ephy_data |= BIT_9;
9173 rtl8168_ephy_write(tp, 0x0C, ephy_data);
9174
9175 break;
9176 case CFG_METHOD_21:
9177 case CFG_METHOD_22:
9178
9179 ephy_data = rtl8168_ephy_read(tp, 0x00);
9180 ephy_data &= ~(BIT_3);
9181 rtl8168_ephy_write(tp, 0x00, ephy_data);
9182 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9183 ephy_data &= ~(BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4);
9184 ephy_data |= (BIT_5 | BIT_11);
9185 rtl8168_ephy_write(tp, 0x0C, ephy_data);
9186
9187 ephy_data = rtl8168_ephy_read(tp, 0x1E);
9188 ephy_data |= (BIT_0);
9189 rtl8168_ephy_write(tp, 0x1E, ephy_data);
9190
9191 ephy_data = rtl8168_ephy_read(tp, 0x19);
9192 ephy_data &= ~(BIT_15);
9193 rtl8168_ephy_write(tp, 0x19, ephy_data);
9194
9195 break;
9196 case CFG_METHOD_25:
9197 ephy_data = rtl8168_ephy_read(tp, 0x00);
9198 ephy_data &= ~BIT_3;
9199 rtl8168_ephy_write(tp, 0x00, ephy_data);
9200 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9201 ephy_data &= ~(BIT_13 | BIT_12 | BIT_11 | BIT_10| BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4);
9202 ephy_data |= (BIT_5 | BIT_11);
9203 rtl8168_ephy_write(tp, 0x0C, ephy_data);
9204
9205 rtl8168_ephy_write(tp, 0x19, 0x7C00);
9206 rtl8168_ephy_write(tp, 0x1E, 0x20EB);
9207 rtl8168_ephy_write(tp, 0x0D, 0x1666);
9208 rtl8168_ephy_write(tp, 0x00, 0x10A3);
9209 rtl8168_ephy_write(tp, 0x06, 0xF050);
9210
9211 SetPCIePhyBit(tp, 0x04, BIT_4);
9212 ClearPCIePhyBit(tp, 0x1D, BIT_14);
9213
9214 break;
9215 case CFG_METHOD_26:
9216 ClearPCIePhyBit(tp, 0x00, BIT_3);
9217 ClearAndSetPCIePhyBit( tp,
9218 0x0C,
9219 (BIT_13 | BIT_12 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_4),
9220 (BIT_5 | BIT_11)
9221 );
9222 SetPCIePhyBit(tp, 0x1E, BIT_0);
9223 ClearPCIePhyBit(tp, 0x19, BIT_15);
9224
9225 ClearPCIePhyBit(tp, 0x19, (BIT_5 | BIT_0));
9226
9227 SetPCIePhyBit(tp, 0x1E, BIT_13);
9228 ClearPCIePhyBit(tp, 0x0D, BIT_8);
9229 SetPCIePhyBit(tp, 0x0D, BIT_9);
9230 SetPCIePhyBit(tp, 0x00, BIT_7);
9231
9232 SetPCIePhyBit(tp, 0x06, BIT_4);
9233
9234 SetPCIePhyBit(tp, 0x04, BIT_4);
9235 SetPCIePhyBit(tp, 0x1D, BIT_14);
9236
9237 break;
9238 case CFG_METHOD_23:
9239 rtl8168_ephy_write(tp, 0x00, 0x10AB);
9240 rtl8168_ephy_write(tp, 0x06, 0xf030);
9241 rtl8168_ephy_write(tp, 0x08, 0x2006);
9242 rtl8168_ephy_write(tp, 0x0D, 0x1666);
9243
9244 ephy_data = rtl8168_ephy_read(tp, 0x0C);
9245 ephy_data &= ~(BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4);
9246 rtl8168_ephy_write(tp, 0x0C, ephy_data);
9247
9248 break;
9249 case CFG_METHOD_27:
9250 rtl8168_ephy_write(tp, 0x00, 0x10A3);
9251 rtl8168_ephy_write(tp, 0x19, 0xFC00);
9252 rtl8168_ephy_write(tp, 0x1E, 0x20EA);
9253
9254 break;
9255 case CFG_METHOD_28:
9256 rtl8168_ephy_write(tp, 0x00, 0x10AB);
9257 rtl8168_ephy_write(tp, 0x19, 0xFC00);
9258 rtl8168_ephy_write(tp, 0x1E, 0x20EB);
9259 rtl8168_ephy_write(tp, 0x0D, 0x1666);
9260 ClearPCIePhyBit(tp, 0x0B, BIT_0);
9261 SetPCIePhyBit(tp, 0x1D, BIT_14);
9262 ClearAndSetPCIePhyBit(tp,
9263 0x0C,
9264 BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5,
9265 BIT_9 | BIT_4
9266 );
9267
9268 break;
9269 case CFG_METHOD_29:
9270 case CFG_METHOD_30:
9271 ClearPCIePhyBit(tp, 0x1E, BIT_11);
9272
9273 SetPCIePhyBit(tp, 0x1E, BIT_0);
9274 SetPCIePhyBit(tp, 0x1D, BIT_11);
9275
9276 rtl8168_ephy_write(tp, 0x05, 0x2089);
9277 rtl8168_ephy_write(tp, 0x06, 0x5881);
9278
9279 rtl8168_ephy_write(tp, 0x04, 0x854A);
9280 rtl8168_ephy_write(tp, 0x01, 0x068B);
9281
9282 break;
9283 case CFG_METHOD_31:
9284 case CFG_METHOD_32:
9285 case CFG_METHOD_33:
9286 ClearAndSetPCIePhyBit(tp,
9287 0x19,
9288 BIT_6,
9289 (BIT_12| BIT_8)
9290 );
9291 ClearAndSetPCIePhyBit(tp,
9292 0x59,
9293 BIT_6,
9294 (BIT_12| BIT_8)
9295 );
9296
9297 ClearPCIePhyBit(tp, 0x0C, BIT_4);
9298 ClearPCIePhyBit(tp, 0x4C, BIT_4);
9299 ClearPCIePhyBit(tp, 0x0B, BIT_0);
9300
9301 break;
9302 }
9303 }
9304
9305 static int
rtl8168_set_phy_mcu_patch_request(struct rtl8168_private * tp)9306 rtl8168_set_phy_mcu_patch_request(struct rtl8168_private *tp)
9307 {
9308 u16 PhyRegValue;
9309 u32 WaitCnt;
9310 int retval = TRUE;
9311
9312 switch (tp->mcfg) {
9313 case CFG_METHOD_21 ... CFG_METHOD_33:
9314 rtl8168_mdio_write(tp,0x1f, 0x0B82);
9315 rtl8168_set_eth_phy_bit(tp, 0x10, BIT_4);
9316
9317 rtl8168_mdio_write(tp,0x1f, 0x0B80);
9318 WaitCnt = 0;
9319 do {
9320 PhyRegValue = rtl8168_mdio_read(tp, 0x10);
9321 udelay(100);
9322 WaitCnt++;
9323 } while (!(PhyRegValue & BIT_6) && (WaitCnt < 1000));
9324
9325 if (!(PhyRegValue & BIT_6) && (WaitCnt == 1000)) retval = FALSE;
9326
9327 rtl8168_mdio_write(tp,0x1f, 0x0000);
9328 break;
9329 }
9330
9331 return retval;
9332 }
9333
9334 static int
rtl8168_clear_phy_mcu_patch_request(struct rtl8168_private * tp)9335 rtl8168_clear_phy_mcu_patch_request(struct rtl8168_private *tp)
9336 {
9337 u16 PhyRegValue;
9338 u32 WaitCnt;
9339 int retval = TRUE;
9340
9341 switch (tp->mcfg) {
9342 case CFG_METHOD_21 ... CFG_METHOD_33:
9343 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
9344 rtl8168_clear_eth_phy_bit(tp, 0x10, BIT_4);
9345
9346 rtl8168_mdio_write(tp,0x1f, 0x0B80);
9347 WaitCnt = 0;
9348 do {
9349 PhyRegValue = rtl8168_mdio_read(tp, 0x10);
9350 udelay(100);
9351 WaitCnt++;
9352 } while ((PhyRegValue & BIT_6) && (WaitCnt < 1000));
9353
9354 if ((PhyRegValue & BIT_6) && (WaitCnt == 1000)) retval = FALSE;
9355
9356 rtl8168_mdio_write(tp,0x1f, 0x0000);
9357 break;
9358 }
9359
9360 return retval;
9361 }
9362
9363 static u16
rtl8168_get_hw_phy_mcu_code_ver(struct rtl8168_private * tp)9364 rtl8168_get_hw_phy_mcu_code_ver(struct rtl8168_private *tp)
9365 {
9366 u16 hw_ram_code_ver = ~0;
9367
9368 switch (tp->mcfg) {
9369 case CFG_METHOD_14:
9370 case CFG_METHOD_15:
9371 rtl8168_mdio_write(tp, 0x1F, 0x0005);
9372 rtl8168_mdio_write(tp, 0x05, 0x8B60);
9373 hw_ram_code_ver = rtl8168_mdio_read(tp, 0x06);
9374 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9375 break;
9376 case CFG_METHOD_16:
9377 case CFG_METHOD_17:
9378 case CFG_METHOD_18:
9379 case CFG_METHOD_19:
9380 case CFG_METHOD_20:
9381 rtl8168_mdio_write(tp, 0x1F, 0x0005);
9382 rtl8168_mdio_write(tp, 0x05, 0x8B30);
9383 hw_ram_code_ver = rtl8168_mdio_read(tp, 0x06);
9384 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9385 break;
9386 case CFG_METHOD_21:
9387 case CFG_METHOD_22:
9388 case CFG_METHOD_23:
9389 case CFG_METHOD_27:
9390 case CFG_METHOD_28:
9391 case CFG_METHOD_24:
9392 case CFG_METHOD_25:
9393 case CFG_METHOD_26:
9394 case CFG_METHOD_29:
9395 case CFG_METHOD_30:
9396 case CFG_METHOD_31:
9397 case CFG_METHOD_32:
9398 case CFG_METHOD_33:
9399 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
9400 rtl8168_mdio_write(tp, 0x13, 0x801E);
9401 hw_ram_code_ver = rtl8168_mdio_read(tp, 0x14);
9402 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9403 break;
9404 default:
9405 tp->hw_ram_code_ver = ~0;
9406 break;
9407 }
9408
9409 return hw_ram_code_ver;
9410 }
9411
9412 #ifndef ENABLE_USE_FIRMWARE_FILE
9413 static void
rtl8168_enable_phy_disable_mode(struct net_device * dev)9414 rtl8168_enable_phy_disable_mode(struct net_device *dev)
9415 {
9416 struct rtl8168_private *tp = netdev_priv(dev);
9417
9418 switch (tp->HwSuppCheckPhyDisableModeVer) {
9419 case 1:
9420 rtl8168_mac_ocp_write(tp, 0xDC20, rtl8168_mac_ocp_read(tp, 0xDC20) | BIT_1);
9421 break;
9422 case 2:
9423 case 3:
9424 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_5);
9425 break;
9426 }
9427
9428 dprintk("enable phy disable mode.\n");
9429 }
9430
9431 static void
rtl8168_disable_phy_disable_mode(struct net_device * dev)9432 rtl8168_disable_phy_disable_mode(struct net_device *dev)
9433 {
9434 struct rtl8168_private *tp = netdev_priv(dev);
9435
9436 switch (tp->HwSuppCheckPhyDisableModeVer) {
9437 case 1:
9438 rtl8168_mac_ocp_write(tp, 0xDC20, rtl8168_mac_ocp_read(tp, 0xDC20) & ~BIT_1);
9439 break;
9440 case 2:
9441 case 3:
9442 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_5);
9443 break;
9444 }
9445
9446 mdelay(1);
9447
9448 dprintk("disable phy disable mode.\n");
9449 }
9450
9451 static int
rtl8168_check_hw_phy_mcu_code_ver(struct net_device * dev)9452 rtl8168_check_hw_phy_mcu_code_ver(struct net_device *dev)
9453 {
9454 struct rtl8168_private *tp = netdev_priv(dev);
9455 int ram_code_ver_match = 0;
9456
9457 tp->hw_ram_code_ver = rtl8168_get_hw_phy_mcu_code_ver(tp);
9458
9459 if ( tp->hw_ram_code_ver == tp->sw_ram_code_ver) {
9460 ram_code_ver_match = 1;
9461 tp->HwHasWrRamCodeToMicroP = TRUE;
9462 }
9463
9464 return ram_code_ver_match;
9465 }
9466
9467 static void
rtl8168_write_hw_phy_mcu_code_ver(struct net_device * dev)9468 rtl8168_write_hw_phy_mcu_code_ver(struct net_device *dev)
9469 {
9470 struct rtl8168_private *tp = netdev_priv(dev);
9471
9472 switch (tp->mcfg) {
9473 case CFG_METHOD_14:
9474 case CFG_METHOD_15:
9475 rtl8168_mdio_write(tp, 0x1F, 0x0005);
9476 rtl8168_mdio_write(tp, 0x05, 0x8B60);
9477 rtl8168_mdio_write(tp, 0x06, tp->sw_ram_code_ver);
9478 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9479 tp->hw_ram_code_ver = tp->sw_ram_code_ver;
9480 break;
9481 case CFG_METHOD_16:
9482 case CFG_METHOD_17:
9483 case CFG_METHOD_18:
9484 case CFG_METHOD_19:
9485 case CFG_METHOD_20:
9486 rtl8168_mdio_write(tp, 0x1F, 0x0005);
9487 rtl8168_mdio_write(tp, 0x05, 0x8B30);
9488 rtl8168_mdio_write(tp, 0x06, tp->sw_ram_code_ver);
9489 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9490 tp->hw_ram_code_ver = tp->sw_ram_code_ver;
9491 break;
9492 case CFG_METHOD_21:
9493 case CFG_METHOD_22:
9494 case CFG_METHOD_23:
9495 case CFG_METHOD_27:
9496 case CFG_METHOD_28:
9497 case CFG_METHOD_24:
9498 case CFG_METHOD_25:
9499 case CFG_METHOD_26:
9500 case CFG_METHOD_29:
9501 case CFG_METHOD_30:
9502 case CFG_METHOD_31:
9503 case CFG_METHOD_32:
9504 case CFG_METHOD_33:
9505 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
9506 rtl8168_mdio_write(tp, 0x13, 0x801E);
9507 rtl8168_mdio_write(tp, 0x14, tp->sw_ram_code_ver);
9508 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9509 tp->hw_ram_code_ver = tp->sw_ram_code_ver;
9510 break;
9511 }
9512 }
9513 static int
rtl8168_phy_ram_code_check(struct net_device * dev)9514 rtl8168_phy_ram_code_check(struct net_device *dev)
9515 {
9516 struct rtl8168_private *tp = netdev_priv(dev);
9517 u16 PhyRegValue;
9518 int retval = TRUE;
9519
9520 switch(tp->mcfg) {
9521 case CFG_METHOD_21:
9522 rtl8168_mdio_write(tp, 0x1f, 0x0A40);
9523 PhyRegValue = rtl8168_mdio_read(tp, 0x10);
9524 PhyRegValue &= ~(BIT_11);
9525 rtl8168_mdio_write(tp, 0x10, PhyRegValue);
9526
9527
9528 rtl8168_mdio_write(tp, 0x1f, 0x0A00);
9529 PhyRegValue = rtl8168_mdio_read(tp, 0x10);
9530 PhyRegValue &= ~(BIT_12 | BIT_13 | BIT_14 | BIT_15);
9531 rtl8168_mdio_write(tp, 0x10, PhyRegValue);
9532
9533 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
9534 rtl8168_mdio_write(tp, 0x13, 0x8010);
9535 PhyRegValue = rtl8168_mdio_read(tp, 0x14);
9536 PhyRegValue &= ~(BIT_11);
9537 rtl8168_mdio_write(tp, 0x14, PhyRegValue);
9538
9539 retval = rtl8168_set_phy_mcu_patch_request(tp);
9540
9541 rtl8168_mdio_write(tp, 0x1f, 0x0A40);
9542 rtl8168_mdio_write(tp, 0x10, 0x0140);
9543
9544 rtl8168_mdio_write(tp, 0x1f, 0x0A4A);
9545 PhyRegValue = rtl8168_mdio_read(tp, 0x13);
9546 PhyRegValue &= ~(BIT_6);
9547 PhyRegValue |= (BIT_7);
9548 rtl8168_mdio_write(tp, 0x13, PhyRegValue);
9549
9550 rtl8168_mdio_write(tp, 0x1f, 0x0A44);
9551 PhyRegValue = rtl8168_mdio_read(tp, 0x14);
9552 PhyRegValue |= (BIT_2);
9553 rtl8168_mdio_write(tp, 0x14, PhyRegValue);
9554
9555 rtl8168_mdio_write(tp, 0x1f, 0x0A50);
9556 PhyRegValue = rtl8168_mdio_read(tp, 0x11);
9557 PhyRegValue |= (BIT_11|BIT_12);
9558 rtl8168_mdio_write(tp, 0x11, PhyRegValue);
9559
9560 retval = rtl8168_clear_phy_mcu_patch_request(tp);
9561
9562 rtl8168_mdio_write(tp, 0x1f, 0x0A40);
9563 rtl8168_mdio_write(tp, 0x10, 0x1040);
9564
9565 rtl8168_mdio_write(tp, 0x1f, 0x0A4A);
9566 PhyRegValue = rtl8168_mdio_read(tp, 0x13);
9567 PhyRegValue &= ~(BIT_6|BIT_7);
9568 rtl8168_mdio_write(tp, 0x13, PhyRegValue);
9569
9570 rtl8168_mdio_write(tp, 0x1f, 0x0A44);
9571 PhyRegValue = rtl8168_mdio_read(tp, 0x14);
9572 PhyRegValue &= ~(BIT_2);
9573 rtl8168_mdio_write(tp, 0x14, PhyRegValue);
9574
9575 rtl8168_mdio_write(tp, 0x1f, 0x0A50);
9576 PhyRegValue = rtl8168_mdio_read(tp, 0x11);
9577 PhyRegValue &= ~(BIT_11|BIT_12);
9578 rtl8168_mdio_write(tp, 0x11, PhyRegValue);
9579
9580 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
9581 rtl8168_mdio_write(tp, 0x13, 0x8010);
9582 PhyRegValue = rtl8168_mdio_read(tp, 0x14);
9583 PhyRegValue |= (BIT_11);
9584 rtl8168_mdio_write(tp, 0x14, PhyRegValue);
9585
9586 retval = rtl8168_set_phy_mcu_patch_request(tp);
9587
9588 rtl8168_mdio_write(tp, 0x1f, 0x0A20);
9589 PhyRegValue = rtl8168_mdio_read(tp, 0x13);
9590 if (PhyRegValue & BIT_11) {
9591 if (PhyRegValue & BIT_10) {
9592 retval = FALSE;
9593 }
9594 }
9595
9596 retval = rtl8168_clear_phy_mcu_patch_request(tp);
9597
9598 mdelay(2);
9599 break;
9600 default:
9601 break;
9602 }
9603
9604 rtl8168_mdio_write(tp, 0x1F, 0x0000);
9605
9606 return retval;
9607 }
9608
9609 static void
rtl8168_set_phy_ram_code_check_fail_flag(struct net_device * dev)9610 rtl8168_set_phy_ram_code_check_fail_flag(struct net_device *dev)
9611 {
9612 struct rtl8168_private *tp = netdev_priv(dev);
9613 u16 TmpUshort;
9614
9615 switch(tp->mcfg) {
9616 case CFG_METHOD_21:
9617 TmpUshort = rtl8168_mac_ocp_read(tp, 0xD3C0);
9618 TmpUshort |= BIT_0;
9619 rtl8168_mac_ocp_write(tp, 0xD3C0, TmpUshort);
9620 break;
9621 }
9622 }
9623
9624 static void
rtl8168_set_phy_mcu_8168e_1(struct net_device * dev)9625 rtl8168_set_phy_mcu_8168e_1(struct net_device *dev)
9626 {
9627 struct rtl8168_private *tp = netdev_priv(dev);
9628 unsigned int gphy_val,i;
9629
9630 rtl8168_mdio_write(tp, 0x1f, 0x0000);
9631 rtl8168_mdio_write(tp, 0x00, 0x1800);
9632 rtl8168_mdio_write(tp, 0x1f, 0x0007);
9633 rtl8168_mdio_write(tp, 0x1e, 0x0023);
9634 rtl8168_mdio_write(tp, 0x17, 0x0117);
9635 rtl8168_mdio_write(tp, 0x1f, 0x0007);
9636 rtl8168_mdio_write(tp, 0x1E, 0x002C);
9637 rtl8168_mdio_write(tp, 0x1B, 0x5000);
9638 rtl8168_mdio_write(tp, 0x1f, 0x0000);
9639 rtl8168_mdio_write(tp, 0x16, 0x4104);
9640 for (i = 0; i < 200; i++) {
9641 udelay(100);
9642 gphy_val = rtl8168_mdio_read(tp, 0x1E);
9643 gphy_val &= 0x03FF;
9644 if (gphy_val == 0x000C)
9645 break;
9646 }
9647 rtl8168_mdio_write(tp, 0x1f, 0x0005);
9648 for (i = 0; i < 200; i++) {
9649 udelay(100);
9650 gphy_val = rtl8168_mdio_read(tp, 0x07);
9651 if ((gphy_val & BIT_5) == 0)
9652 break;
9653 }
9654 gphy_val = rtl8168_mdio_read(tp, 0x07);
9655 if (gphy_val & BIT_5) {
9656 rtl8168_mdio_write(tp, 0x1f, 0x0007);
9657 rtl8168_mdio_write(tp, 0x1e, 0x00a1);
9658 rtl8168_mdio_write(tp, 0x17, 0x1000);
9659 rtl8168_mdio_write(tp, 0x17, 0x0000);
9660 rtl8168_mdio_write(tp, 0x17, 0x2000);
9661 rtl8168_mdio_write(tp, 0x1e, 0x002f);
9662 rtl8168_mdio_write(tp, 0x18, 0x9bfb);
9663 rtl8168_mdio_write(tp, 0x1f, 0x0005);
9664 rtl8168_mdio_write(tp, 0x07, 0x0000);
9665 rtl8168_mdio_write(tp, 0x1f, 0x0000);
9666 }
9667 rtl8168_mdio_write(tp, 0x1f, 0x0005);
9668 rtl8168_mdio_write(tp, 0x05, 0xfff6);
9669 rtl8168_mdio_write(tp, 0x06, 0x0080);
9670 gphy_val = rtl8168_mdio_read(tp, 0x00);
9671 gphy_val &= ~(BIT_7);
9672 rtl8168_mdio_write(tp, 0x00, gphy_val);
9673 rtl8168_mdio_write(tp, 0x1f, 0x0002);
9674 gphy_val = rtl8168_mdio_read(tp, 0x08);
9675 gphy_val &= ~(BIT_7);
9676 rtl8168_mdio_write(tp, 0x08, gphy_val);
9677 rtl8168_mdio_write(tp, 0x1f, 0x0000);
9678 rtl8168_mdio_write(tp, 0x1f, 0x0007);
9679 rtl8168_mdio_write(tp, 0x1e, 0x0023);
9680 rtl8168_mdio_write(tp, 0x16, 0x0306);
9681 rtl8168_mdio_write(tp, 0x16, 0x0307);
9682 rtl8168_mdio_write(tp, 0x15, 0x000e);
9683 rtl8168_mdio_write(tp, 0x19, 0x000a);
9684 rtl8168_mdio_write(tp, 0x15, 0x0010);
9685 rtl8168_mdio_write(tp, 0x19, 0x0008);
9686 rtl8168_mdio_write(tp, 0x15, 0x0018);
9687 rtl8168_mdio_write(tp, 0x19, 0x4801);
9688 rtl8168_mdio_write(tp, 0x15, 0x0019);
9689 rtl8168_mdio_write(tp, 0x19, 0x6801);
9690 rtl8168_mdio_write(tp, 0x15, 0x001a);
9691 rtl8168_mdio_write(tp, 0x19, 0x66a1);
9692 rtl8168_mdio_write(tp, 0x15, 0x001f);
9693 rtl8168_mdio_write(tp, 0x19, 0x0000);
9694 rtl8168_mdio_write(tp, 0x15, 0x0020);
9695 rtl8168_mdio_write(tp, 0x19, 0x0000);
9696 rtl8168_mdio_write(tp, 0x15, 0x0021);
9697 rtl8168_mdio_write(tp, 0x19, 0x0000);
9698 rtl8168_mdio_write(tp, 0x15, 0x0022);
9699 rtl8168_mdio_write(tp, 0x19, 0x0000);
9700 rtl8168_mdio_write(tp, 0x15, 0x0023);
9701 rtl8168_mdio_write(tp, 0x19, 0x0000);
9702 rtl8168_mdio_write(tp, 0x15, 0x0024);
9703 rtl8168_mdio_write(tp, 0x19, 0x0000);
9704 rtl8168_mdio_write(tp, 0x15, 0x0025);
9705 rtl8168_mdio_write(tp, 0x19, 0x64a1);
9706 rtl8168_mdio_write(tp, 0x15, 0x0026);
9707 rtl8168_mdio_write(tp, 0x19, 0x40ea);
9708 rtl8168_mdio_write(tp, 0x15, 0x0027);
9709 rtl8168_mdio_write(tp, 0x19, 0x4503);
9710 rtl8168_mdio_write(tp, 0x15, 0x0028);
9711 rtl8168_mdio_write(tp, 0x19, 0x9f00);
9712 rtl8168_mdio_write(tp, 0x15, 0x0029);
9713 rtl8168_mdio_write(tp, 0x19, 0xa631);
9714 rtl8168_mdio_write(tp, 0x15, 0x002a);
9715 rtl8168_mdio_write(tp, 0x19, 0x9717);
9716 rtl8168_mdio_write(tp, 0x15, 0x002b);
9717 rtl8168_mdio_write(tp, 0x19, 0x302c);
9718 rtl8168_mdio_write(tp, 0x15, 0x002c);
9719 rtl8168_mdio_write(tp, 0x19, 0x4802);
9720 rtl8168_mdio_write(tp, 0x15, 0x002d);
9721 rtl8168_mdio_write(tp, 0x19, 0x58da);
9722 rtl8168_mdio_write(tp, 0x15, 0x002e);
9723 rtl8168_mdio_write(tp, 0x19, 0x400d);
9724 rtl8168_mdio_write(tp, 0x15, 0x002f);
9725 rtl8168_mdio_write(tp, 0x19, 0x4488);
9726 rtl8168_mdio_write(tp, 0x15, 0x0030);
9727 rtl8168_mdio_write(tp, 0x19, 0x9e00);
9728 rtl8168_mdio_write(tp, 0x15, 0x0031);
9729 rtl8168_mdio_write(tp, 0x19, 0x63c8);
9730 rtl8168_mdio_write(tp, 0x15, 0x0032);
9731 rtl8168_mdio_write(tp, 0x19, 0x6481);
9732 rtl8168_mdio_write(tp, 0x15, 0x0033);
9733 rtl8168_mdio_write(tp, 0x19, 0x0000);
9734 rtl8168_mdio_write(tp, 0x15, 0x0034);
9735 rtl8168_mdio_write(tp, 0x19, 0x0000);
9736 rtl8168_mdio_write(tp, 0x15, 0x0035);
9737 rtl8168_mdio_write(tp, 0x19, 0x0000);
9738 rtl8168_mdio_write(tp, 0x15, 0x0036);
9739 rtl8168_mdio_write(tp, 0x19, 0x0000);
9740 rtl8168_mdio_write(tp, 0x15, 0x0037);
9741 rtl8168_mdio_write(tp, 0x19, 0x0000);
9742 rtl8168_mdio_write(tp, 0x15, 0x0038);
9743 rtl8168_mdio_write(tp, 0x19, 0x0000);
9744 rtl8168_mdio_write(tp, 0x15, 0x0039);
9745 rtl8168_mdio_write(tp, 0x19, 0x0000);
9746 rtl8168_mdio_write(tp, 0x15, 0x003a);
9747 rtl8168_mdio_write(tp, 0x19, 0x0000);
9748 rtl8168_mdio_write(tp, 0x15, 0x003b);
9749 rtl8168_mdio_write(tp, 0x19, 0x63e8);
9750 rtl8168_mdio_write(tp, 0x15, 0x003c);
9751 rtl8168_mdio_write(tp, 0x19, 0x7d00);
9752 rtl8168_mdio_write(tp, 0x15, 0x003d);
9753 rtl8168_mdio_write(tp, 0x19, 0x59d4);
9754 rtl8168_mdio_write(tp, 0x15, 0x003e);
9755 rtl8168_mdio_write(tp, 0x19, 0x63f8);
9756 rtl8168_mdio_write(tp, 0x15, 0x0040);
9757 rtl8168_mdio_write(tp, 0x19, 0x64a1);
9758 rtl8168_mdio_write(tp, 0x15, 0x0041);
9759 rtl8168_mdio_write(tp, 0x19, 0x30de);
9760 rtl8168_mdio_write(tp, 0x15, 0x0044);
9761 rtl8168_mdio_write(tp, 0x19, 0x480f);
9762 rtl8168_mdio_write(tp, 0x15, 0x0045);
9763 rtl8168_mdio_write(tp, 0x19, 0x6800);
9764 rtl8168_mdio_write(tp, 0x15, 0x0046);
9765 rtl8168_mdio_write(tp, 0x19, 0x6680);
9766 rtl8168_mdio_write(tp, 0x15, 0x0047);
9767 rtl8168_mdio_write(tp, 0x19, 0x7c10);
9768 rtl8168_mdio_write(tp, 0x15, 0x0048);
9769 rtl8168_mdio_write(tp, 0x19, 0x63c8);
9770 rtl8168_mdio_write(tp, 0x15, 0x0049);
9771 rtl8168_mdio_write(tp, 0x19, 0x0000);
9772 rtl8168_mdio_write(tp, 0x15, 0x004a);
9773 rtl8168_mdio_write(tp, 0x19, 0x0000);
9774 rtl8168_mdio_write(tp, 0x15, 0x004b);
9775 rtl8168_mdio_write(tp, 0x19, 0x0000);
9776 rtl8168_mdio_write(tp, 0x15, 0x004c);
9777 rtl8168_mdio_write(tp, 0x19, 0x0000);
9778 rtl8168_mdio_write(tp, 0x15, 0x004d);
9779 rtl8168_mdio_write(tp, 0x19, 0x0000);
9780 rtl8168_mdio_write(tp, 0x15, 0x004e);
9781 rtl8168_mdio_write(tp, 0x19, 0x0000);
9782 rtl8168_mdio_write(tp, 0x15, 0x004f);
9783 rtl8168_mdio_write(tp, 0x19, 0x40ea);
9784 rtl8168_mdio_write(tp, 0x15, 0x0050);
9785 rtl8168_mdio_write(tp, 0x19, 0x4503);
9786 rtl8168_mdio_write(tp, 0x15, 0x0051);
9787 rtl8168_mdio_write(tp, 0x19, 0x58ca);
9788 rtl8168_mdio_write(tp, 0x15, 0x0052);
9789 rtl8168_mdio_write(tp, 0x19, 0x63c8);
9790 rtl8168_mdio_write(tp, 0x15, 0x0053);
9791 rtl8168_mdio_write(tp, 0x19, 0x63d8);
9792 rtl8168_mdio_write(tp, 0x15, 0x0054);
9793 rtl8168_mdio_write(tp, 0x19, 0x66a0);
9794 rtl8168_mdio_write(tp, 0x15, 0x0055);
9795 rtl8168_mdio_write(tp, 0x19, 0x9f00);
9796 rtl8168_mdio_write(tp, 0x15, 0x0056);
9797 rtl8168_mdio_write(tp, 0x19, 0x3000);
9798 rtl8168_mdio_write(tp, 0x15, 0x006E);
9799 rtl8168_mdio_write(tp, 0x19, 0x9afa);
9800 rtl8168_mdio_write(tp, 0x15, 0x00a1);
9801 rtl8168_mdio_write(tp, 0x19, 0x3044);
9802 rtl8168_mdio_write(tp, 0x15, 0x00ab);
9803 rtl8168_mdio_write(tp, 0x19, 0x5820);
9804 rtl8168_mdio_write(tp, 0x15, 0x00ac);
9805 rtl8168_mdio_write(tp, 0x19, 0x5e04);
9806 rtl8168_mdio_write(tp, 0x15, 0x00ad);
9807 rtl8168_mdio_write(tp, 0x19, 0xb60c);
9808 rtl8168_mdio_write(tp, 0x15, 0x00af);
9809 rtl8168_mdio_write(tp, 0x19, 0x000a);
9810 rtl8168_mdio_write(tp, 0x15, 0x00b2);
9811 rtl8168_mdio_write(tp, 0x19, 0x30b9);
9812 rtl8168_mdio_write(tp, 0x15, 0x00b9);
9813 rtl8168_mdio_write(tp, 0x19, 0x4408);
9814 rtl8168_mdio_write(tp, 0x15, 0x00ba);
9815 rtl8168_mdio_write(tp, 0x19, 0x480b);
9816 rtl8168_mdio_write(tp, 0x15, 0x00bb);
9817 rtl8168_mdio_write(tp, 0x19, 0x5e00);
9818 rtl8168_mdio_write(tp, 0x15, 0x00bc);
9819 rtl8168_mdio_write(tp, 0x19, 0x405f);
9820 rtl8168_mdio_write(tp, 0x15, 0x00bd);
9821 rtl8168_mdio_write(tp, 0x19, 0x4448);
9822 rtl8168_mdio_write(tp, 0x15, 0x00be);
9823 rtl8168_mdio_write(tp, 0x19, 0x4020);
9824 rtl8168_mdio_write(tp, 0x15, 0x00bf);
9825 rtl8168_mdio_write(tp, 0x19, 0x4468);
9826 rtl8168_mdio_write(tp, 0x15, 0x00c0);
9827 rtl8168_mdio_write(tp, 0x19, 0x9c02);
9828 rtl8168_mdio_write(tp, 0x15, 0x00c1);
9829 rtl8168_mdio_write(tp, 0x19, 0x58a0);
9830 rtl8168_mdio_write(tp, 0x15, 0x00c2);
9831 rtl8168_mdio_write(tp, 0x19, 0xb605);
9832 rtl8168_mdio_write(tp, 0x15, 0x00c3);
9833 rtl8168_mdio_write(tp, 0x19, 0xc0d3);
9834 rtl8168_mdio_write(tp, 0x15, 0x00c4);
9835 rtl8168_mdio_write(tp, 0x19, 0x00e6);
9836 rtl8168_mdio_write(tp, 0x15, 0x00c5);
9837 rtl8168_mdio_write(tp, 0x19, 0xdaec);
9838 rtl8168_mdio_write(tp, 0x15, 0x00c6);
9839 rtl8168_mdio_write(tp, 0x19, 0x00fa);
9840 rtl8168_mdio_write(tp, 0x15, 0x00c7);
9841 rtl8168_mdio_write(tp, 0x19, 0x9df9);
9842 rtl8168_mdio_write(tp, 0x15, 0x00c8);
9843 rtl8168_mdio_write(tp, 0x19, 0x307a);
9844 rtl8168_mdio_write(tp, 0x15, 0x0112);
9845 rtl8168_mdio_write(tp, 0x19, 0x6421);
9846 rtl8168_mdio_write(tp, 0x15, 0x0113);
9847 rtl8168_mdio_write(tp, 0x19, 0x7c08);
9848 rtl8168_mdio_write(tp, 0x15, 0x0114);
9849 rtl8168_mdio_write(tp, 0x19, 0x63f0);
9850 rtl8168_mdio_write(tp, 0x15, 0x0115);
9851 rtl8168_mdio_write(tp, 0x19, 0x4003);
9852 rtl8168_mdio_write(tp, 0x15, 0x0116);
9853 rtl8168_mdio_write(tp, 0x19, 0x4418);
9854 rtl8168_mdio_write(tp, 0x15, 0x0117);
9855 rtl8168_mdio_write(tp, 0x19, 0x9b00);
9856 rtl8168_mdio_write(tp, 0x15, 0x0118);
9857 rtl8168_mdio_write(tp, 0x19, 0x6461);
9858 rtl8168_mdio_write(tp, 0x15, 0x0119);
9859 rtl8168_mdio_write(tp, 0x19, 0x64e1);
9860 rtl8168_mdio_write(tp, 0x15, 0x011a);
9861 rtl8168_mdio_write(tp, 0x19, 0x0000);
9862 rtl8168_mdio_write(tp, 0x15, 0x0150);
9863 rtl8168_mdio_write(tp, 0x19, 0x7c80);
9864 rtl8168_mdio_write(tp, 0x15, 0x0151);
9865 rtl8168_mdio_write(tp, 0x19, 0x6461);
9866 rtl8168_mdio_write(tp, 0x15, 0x0152);
9867 rtl8168_mdio_write(tp, 0x19, 0x4003);
9868 rtl8168_mdio_write(tp, 0x15, 0x0153);
9869 rtl8168_mdio_write(tp, 0x19, 0x4540);
9870 rtl8168_mdio_write(tp, 0x15, 0x0154);
9871 rtl8168_mdio_write(tp, 0x19, 0x9f00);
9872 rtl8168_mdio_write(tp, 0x15, 0x0155);
9873 rtl8168_mdio_write(tp, 0x19, 0x9d00);
9874 rtl8168_mdio_write(tp, 0x15, 0x0156);
9875 rtl8168_mdio_write(tp, 0x19, 0x7c40);
9876 rtl8168_mdio_write(tp, 0x15, 0x0157);
9877 rtl8168_mdio_write(tp, 0x19, 0x6421);
9878 rtl8168_mdio_write(tp, 0x15, 0x0158);
9879 rtl8168_mdio_write(tp, 0x19, 0x7c80);
9880 rtl8168_mdio_write(tp, 0x15, 0x0159);
9881 rtl8168_mdio_write(tp, 0x19, 0x64a1);
9882 rtl8168_mdio_write(tp, 0x15, 0x015a);
9883 rtl8168_mdio_write(tp, 0x19, 0x30fe);
9884 rtl8168_mdio_write(tp, 0x15, 0x021e);
9885 rtl8168_mdio_write(tp, 0x19, 0x5410);
9886 rtl8168_mdio_write(tp, 0x15, 0x0225);
9887 rtl8168_mdio_write(tp, 0x19, 0x5400);
9888 rtl8168_mdio_write(tp, 0x15, 0x023D);
9889 rtl8168_mdio_write(tp, 0x19, 0x4050);
9890 rtl8168_mdio_write(tp, 0x15, 0x0295);
9891 rtl8168_mdio_write(tp, 0x19, 0x6c08);
9892 rtl8168_mdio_write(tp, 0x15, 0x02bd);
9893 rtl8168_mdio_write(tp, 0x19, 0xa523);
9894 rtl8168_mdio_write(tp, 0x15, 0x02be);
9895 rtl8168_mdio_write(tp, 0x19, 0x32ca);
9896 rtl8168_mdio_write(tp, 0x15, 0x02ca);
9897 rtl8168_mdio_write(tp, 0x19, 0x48b3);
9898 rtl8168_mdio_write(tp, 0x15, 0x02cb);
9899 rtl8168_mdio_write(tp, 0x19, 0x4020);
9900 rtl8168_mdio_write(tp, 0x15, 0x02cc);
9901 rtl8168_mdio_write(tp, 0x19, 0x4823);
9902 rtl8168_mdio_write(tp, 0x15, 0x02cd);
9903 rtl8168_mdio_write(tp, 0x19, 0x4510);
9904 rtl8168_mdio_write(tp, 0x15, 0x02ce);
9905 rtl8168_mdio_write(tp, 0x19, 0xb63a);
9906 rtl8168_mdio_write(tp, 0x15, 0x02cf);
9907 rtl8168_mdio_write(tp, 0x19, 0x7dc8);
9908 rtl8168_mdio_write(tp, 0x15, 0x02d6);
9909 rtl8168_mdio_write(tp, 0x19, 0x9bf8);
9910 rtl8168_mdio_write(tp, 0x15, 0x02d8);
9911 rtl8168_mdio_write(tp, 0x19, 0x85f6);
9912 rtl8168_mdio_write(tp, 0x15, 0x02d9);
9913 rtl8168_mdio_write(tp, 0x19, 0x32e0);
9914 rtl8168_mdio_write(tp, 0x15, 0x02e0);
9915 rtl8168_mdio_write(tp, 0x19, 0x4834);
9916 rtl8168_mdio_write(tp, 0x15, 0x02e1);
9917 rtl8168_mdio_write(tp, 0x19, 0x6c08);
9918 rtl8168_mdio_write(tp, 0x15, 0x02e2);
9919 rtl8168_mdio_write(tp, 0x19, 0x4020);
9920 rtl8168_mdio_write(tp, 0x15, 0x02e3);
9921 rtl8168_mdio_write(tp, 0x19, 0x4824);
9922 rtl8168_mdio_write(tp, 0x15, 0x02e4);
9923 rtl8168_mdio_write(tp, 0x19, 0x4520);
9924 rtl8168_mdio_write(tp, 0x15, 0x02e5);
9925 rtl8168_mdio_write(tp, 0x19, 0x4008);
9926 rtl8168_mdio_write(tp, 0x15, 0x02e6);
9927 rtl8168_mdio_write(tp, 0x19, 0x4560);
9928 rtl8168_mdio_write(tp, 0x15, 0x02e7);
9929 rtl8168_mdio_write(tp, 0x19, 0x9d04);
9930 rtl8168_mdio_write(tp, 0x15, 0x02e8);
9931 rtl8168_mdio_write(tp, 0x19, 0x48c4);
9932 rtl8168_mdio_write(tp, 0x15, 0x02e9);
9933 rtl8168_mdio_write(tp, 0x19, 0x0000);
9934 rtl8168_mdio_write(tp, 0x15, 0x02ea);
9935 rtl8168_mdio_write(tp, 0x19, 0x4844);
9936 rtl8168_mdio_write(tp, 0x15, 0x02eb);
9937 rtl8168_mdio_write(tp, 0x19, 0x7dc8);
9938 rtl8168_mdio_write(tp, 0x15, 0x02f0);
9939 rtl8168_mdio_write(tp, 0x19, 0x9cf7);
9940 rtl8168_mdio_write(tp, 0x15, 0x02f1);
9941 rtl8168_mdio_write(tp, 0x19, 0xdf94);
9942 rtl8168_mdio_write(tp, 0x15, 0x02f2);
9943 rtl8168_mdio_write(tp, 0x19, 0x0002);
9944 rtl8168_mdio_write(tp, 0x15, 0x02f3);
9945 rtl8168_mdio_write(tp, 0x19, 0x6810);
9946 rtl8168_mdio_write(tp, 0x15, 0x02f4);
9947 rtl8168_mdio_write(tp, 0x19, 0xb614);
9948 rtl8168_mdio_write(tp, 0x15, 0x02f5);
9949 rtl8168_mdio_write(tp, 0x19, 0xc42b);
9950 rtl8168_mdio_write(tp, 0x15, 0x02f6);
9951 rtl8168_mdio_write(tp, 0x19, 0x00d4);
9952 rtl8168_mdio_write(tp, 0x15, 0x02f7);
9953 rtl8168_mdio_write(tp, 0x19, 0xc455);
9954 rtl8168_mdio_write(tp, 0x15, 0x02f8);
9955 rtl8168_mdio_write(tp, 0x19, 0x0093);
9956 rtl8168_mdio_write(tp, 0x15, 0x02f9);
9957 rtl8168_mdio_write(tp, 0x19, 0x92ee);
9958 rtl8168_mdio_write(tp, 0x15, 0x02fa);
9959 rtl8168_mdio_write(tp, 0x19, 0xefed);
9960 rtl8168_mdio_write(tp, 0x15, 0x02fb);
9961 rtl8168_mdio_write(tp, 0x19, 0x3312);
9962 rtl8168_mdio_write(tp, 0x15, 0x0312);
9963 rtl8168_mdio_write(tp, 0x19, 0x49b5);
9964 rtl8168_mdio_write(tp, 0x15, 0x0313);
9965 rtl8168_mdio_write(tp, 0x19, 0x7d00);
9966 rtl8168_mdio_write(tp, 0x15, 0x0314);
9967 rtl8168_mdio_write(tp, 0x19, 0x4d00);
9968 rtl8168_mdio_write(tp, 0x15, 0x0315);
9969 rtl8168_mdio_write(tp, 0x19, 0x6810);
9970 rtl8168_mdio_write(tp, 0x15, 0x031e);
9971 rtl8168_mdio_write(tp, 0x19, 0x404f);
9972 rtl8168_mdio_write(tp, 0x15, 0x031f);
9973 rtl8168_mdio_write(tp, 0x19, 0x44c8);
9974 rtl8168_mdio_write(tp, 0x15, 0x0320);
9975 rtl8168_mdio_write(tp, 0x19, 0xd64f);
9976 rtl8168_mdio_write(tp, 0x15, 0x0321);
9977 rtl8168_mdio_write(tp, 0x19, 0x00e7);
9978 rtl8168_mdio_write(tp, 0x15, 0x0322);
9979 rtl8168_mdio_write(tp, 0x19, 0x7c08);
9980 rtl8168_mdio_write(tp, 0x15, 0x0323);
9981 rtl8168_mdio_write(tp, 0x19, 0x8203);
9982 rtl8168_mdio_write(tp, 0x15, 0x0324);
9983 rtl8168_mdio_write(tp, 0x19, 0x4d48);
9984 rtl8168_mdio_write(tp, 0x15, 0x0325);
9985 rtl8168_mdio_write(tp, 0x19, 0x3327);
9986 rtl8168_mdio_write(tp, 0x15, 0x0326);
9987 rtl8168_mdio_write(tp, 0x19, 0x4d40);
9988 rtl8168_mdio_write(tp, 0x15, 0x0327);
9989 rtl8168_mdio_write(tp, 0x19, 0xc8d7);
9990 rtl8168_mdio_write(tp, 0x15, 0x0328);
9991 rtl8168_mdio_write(tp, 0x19, 0x0003);
9992 rtl8168_mdio_write(tp, 0x15, 0x0329);
9993 rtl8168_mdio_write(tp, 0x19, 0x7c20);
9994 rtl8168_mdio_write(tp, 0x15, 0x032a);
9995 rtl8168_mdio_write(tp, 0x19, 0x4c20);
9996 rtl8168_mdio_write(tp, 0x15, 0x032b);
9997 rtl8168_mdio_write(tp, 0x19, 0xc8ed);
9998 rtl8168_mdio_write(tp, 0x15, 0x032c);
9999 rtl8168_mdio_write(tp, 0x19, 0x00f4);
10000 rtl8168_mdio_write(tp, 0x15, 0x032d);
10001 rtl8168_mdio_write(tp, 0x19, 0x82b3);
10002 rtl8168_mdio_write(tp, 0x15, 0x032e);
10003 rtl8168_mdio_write(tp, 0x19, 0xd11d);
10004 rtl8168_mdio_write(tp, 0x15, 0x032f);
10005 rtl8168_mdio_write(tp, 0x19, 0x00b1);
10006 rtl8168_mdio_write(tp, 0x15, 0x0330);
10007 rtl8168_mdio_write(tp, 0x19, 0xde18);
10008 rtl8168_mdio_write(tp, 0x15, 0x0331);
10009 rtl8168_mdio_write(tp, 0x19, 0x0008);
10010 rtl8168_mdio_write(tp, 0x15, 0x0332);
10011 rtl8168_mdio_write(tp, 0x19, 0x91ee);
10012 rtl8168_mdio_write(tp, 0x15, 0x0333);
10013 rtl8168_mdio_write(tp, 0x19, 0x3339);
10014 rtl8168_mdio_write(tp, 0x15, 0x033a);
10015 rtl8168_mdio_write(tp, 0x19, 0x4064);
10016 rtl8168_mdio_write(tp, 0x15, 0x0340);
10017 rtl8168_mdio_write(tp, 0x19, 0x9e06);
10018 rtl8168_mdio_write(tp, 0x15, 0x0341);
10019 rtl8168_mdio_write(tp, 0x19, 0x7c08);
10020 rtl8168_mdio_write(tp, 0x15, 0x0342);
10021 rtl8168_mdio_write(tp, 0x19, 0x8203);
10022 rtl8168_mdio_write(tp, 0x15, 0x0343);
10023 rtl8168_mdio_write(tp, 0x19, 0x4d48);
10024 rtl8168_mdio_write(tp, 0x15, 0x0344);
10025 rtl8168_mdio_write(tp, 0x19, 0x3346);
10026 rtl8168_mdio_write(tp, 0x15, 0x0345);
10027 rtl8168_mdio_write(tp, 0x19, 0x4d40);
10028 rtl8168_mdio_write(tp, 0x15, 0x0346);
10029 rtl8168_mdio_write(tp, 0x19, 0xd11d);
10030 rtl8168_mdio_write(tp, 0x15, 0x0347);
10031 rtl8168_mdio_write(tp, 0x19, 0x0099);
10032 rtl8168_mdio_write(tp, 0x15, 0x0348);
10033 rtl8168_mdio_write(tp, 0x19, 0xbb17);
10034 rtl8168_mdio_write(tp, 0x15, 0x0349);
10035 rtl8168_mdio_write(tp, 0x19, 0x8102);
10036 rtl8168_mdio_write(tp, 0x15, 0x034a);
10037 rtl8168_mdio_write(tp, 0x19, 0x334d);
10038 rtl8168_mdio_write(tp, 0x15, 0x034b);
10039 rtl8168_mdio_write(tp, 0x19, 0xa22c);
10040 rtl8168_mdio_write(tp, 0x15, 0x034c);
10041 rtl8168_mdio_write(tp, 0x19, 0x3397);
10042 rtl8168_mdio_write(tp, 0x15, 0x034d);
10043 rtl8168_mdio_write(tp, 0x19, 0x91f2);
10044 rtl8168_mdio_write(tp, 0x15, 0x034e);
10045 rtl8168_mdio_write(tp, 0x19, 0xc218);
10046 rtl8168_mdio_write(tp, 0x15, 0x034f);
10047 rtl8168_mdio_write(tp, 0x19, 0x00f0);
10048 rtl8168_mdio_write(tp, 0x15, 0x0350);
10049 rtl8168_mdio_write(tp, 0x19, 0x3397);
10050 rtl8168_mdio_write(tp, 0x15, 0x0351);
10051 rtl8168_mdio_write(tp, 0x19, 0x0000);
10052 rtl8168_mdio_write(tp, 0x15, 0x0364);
10053 rtl8168_mdio_write(tp, 0x19, 0xbc05);
10054 rtl8168_mdio_write(tp, 0x15, 0x0367);
10055 rtl8168_mdio_write(tp, 0x19, 0xa1fc);
10056 rtl8168_mdio_write(tp, 0x15, 0x0368);
10057 rtl8168_mdio_write(tp, 0x19, 0x3377);
10058 rtl8168_mdio_write(tp, 0x15, 0x0369);
10059 rtl8168_mdio_write(tp, 0x19, 0x328b);
10060 rtl8168_mdio_write(tp, 0x15, 0x036a);
10061 rtl8168_mdio_write(tp, 0x19, 0x0000);
10062 rtl8168_mdio_write(tp, 0x15, 0x0377);
10063 rtl8168_mdio_write(tp, 0x19, 0x4b97);
10064 rtl8168_mdio_write(tp, 0x15, 0x0378);
10065 rtl8168_mdio_write(tp, 0x19, 0x6818);
10066 rtl8168_mdio_write(tp, 0x15, 0x0379);
10067 rtl8168_mdio_write(tp, 0x19, 0x4b07);
10068 rtl8168_mdio_write(tp, 0x15, 0x037a);
10069 rtl8168_mdio_write(tp, 0x19, 0x40ac);
10070 rtl8168_mdio_write(tp, 0x15, 0x037b);
10071 rtl8168_mdio_write(tp, 0x19, 0x4445);
10072 rtl8168_mdio_write(tp, 0x15, 0x037c);
10073 rtl8168_mdio_write(tp, 0x19, 0x404e);
10074 rtl8168_mdio_write(tp, 0x15, 0x037d);
10075 rtl8168_mdio_write(tp, 0x19, 0x4461);
10076 rtl8168_mdio_write(tp, 0x15, 0x037e);
10077 rtl8168_mdio_write(tp, 0x19, 0x9c09);
10078 rtl8168_mdio_write(tp, 0x15, 0x037f);
10079 rtl8168_mdio_write(tp, 0x19, 0x63da);
10080 rtl8168_mdio_write(tp, 0x15, 0x0380);
10081 rtl8168_mdio_write(tp, 0x19, 0x5440);
10082 rtl8168_mdio_write(tp, 0x15, 0x0381);
10083 rtl8168_mdio_write(tp, 0x19, 0x4b98);
10084 rtl8168_mdio_write(tp, 0x15, 0x0382);
10085 rtl8168_mdio_write(tp, 0x19, 0x7c60);
10086 rtl8168_mdio_write(tp, 0x15, 0x0383);
10087 rtl8168_mdio_write(tp, 0x19, 0x4c00);
10088 rtl8168_mdio_write(tp, 0x15, 0x0384);
10089 rtl8168_mdio_write(tp, 0x19, 0x4b08);
10090 rtl8168_mdio_write(tp, 0x15, 0x0385);
10091 rtl8168_mdio_write(tp, 0x19, 0x63d8);
10092 rtl8168_mdio_write(tp, 0x15, 0x0386);
10093 rtl8168_mdio_write(tp, 0x19, 0x338d);
10094 rtl8168_mdio_write(tp, 0x15, 0x0387);
10095 rtl8168_mdio_write(tp, 0x19, 0xd64f);
10096 rtl8168_mdio_write(tp, 0x15, 0x0388);
10097 rtl8168_mdio_write(tp, 0x19, 0x0080);
10098 rtl8168_mdio_write(tp, 0x15, 0x0389);
10099 rtl8168_mdio_write(tp, 0x19, 0x820c);
10100 rtl8168_mdio_write(tp, 0x15, 0x038a);
10101 rtl8168_mdio_write(tp, 0x19, 0xa10b);
10102 rtl8168_mdio_write(tp, 0x15, 0x038b);
10103 rtl8168_mdio_write(tp, 0x19, 0x9df3);
10104 rtl8168_mdio_write(tp, 0x15, 0x038c);
10105 rtl8168_mdio_write(tp, 0x19, 0x3395);
10106 rtl8168_mdio_write(tp, 0x15, 0x038d);
10107 rtl8168_mdio_write(tp, 0x19, 0xd64f);
10108 rtl8168_mdio_write(tp, 0x15, 0x038e);
10109 rtl8168_mdio_write(tp, 0x19, 0x00f9);
10110 rtl8168_mdio_write(tp, 0x15, 0x038f);
10111 rtl8168_mdio_write(tp, 0x19, 0xc017);
10112 rtl8168_mdio_write(tp, 0x15, 0x0390);
10113 rtl8168_mdio_write(tp, 0x19, 0x0005);
10114 rtl8168_mdio_write(tp, 0x15, 0x0391);
10115 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
10116 rtl8168_mdio_write(tp, 0x15, 0x0392);
10117 rtl8168_mdio_write(tp, 0x19, 0xa103);
10118 rtl8168_mdio_write(tp, 0x15, 0x0393);
10119 rtl8168_mdio_write(tp, 0x19, 0x6c08);
10120 rtl8168_mdio_write(tp, 0x15, 0x0394);
10121 rtl8168_mdio_write(tp, 0x19, 0x9df9);
10122 rtl8168_mdio_write(tp, 0x15, 0x0395);
10123 rtl8168_mdio_write(tp, 0x19, 0x6c08);
10124 rtl8168_mdio_write(tp, 0x15, 0x0396);
10125 rtl8168_mdio_write(tp, 0x19, 0x3397);
10126 rtl8168_mdio_write(tp, 0x15, 0x0399);
10127 rtl8168_mdio_write(tp, 0x19, 0x6810);
10128 rtl8168_mdio_write(tp, 0x15, 0x03a4);
10129 rtl8168_mdio_write(tp, 0x19, 0x7c08);
10130 rtl8168_mdio_write(tp, 0x15, 0x03a5);
10131 rtl8168_mdio_write(tp, 0x19, 0x8203);
10132 rtl8168_mdio_write(tp, 0x15, 0x03a6);
10133 rtl8168_mdio_write(tp, 0x19, 0x4d08);
10134 rtl8168_mdio_write(tp, 0x15, 0x03a7);
10135 rtl8168_mdio_write(tp, 0x19, 0x33a9);
10136 rtl8168_mdio_write(tp, 0x15, 0x03a8);
10137 rtl8168_mdio_write(tp, 0x19, 0x4d00);
10138 rtl8168_mdio_write(tp, 0x15, 0x03a9);
10139 rtl8168_mdio_write(tp, 0x19, 0x9bfa);
10140 rtl8168_mdio_write(tp, 0x15, 0x03aa);
10141 rtl8168_mdio_write(tp, 0x19, 0x33b6);
10142 rtl8168_mdio_write(tp, 0x15, 0x03bb);
10143 rtl8168_mdio_write(tp, 0x19, 0x4056);
10144 rtl8168_mdio_write(tp, 0x15, 0x03bc);
10145 rtl8168_mdio_write(tp, 0x19, 0x44e9);
10146 rtl8168_mdio_write(tp, 0x15, 0x03bd);
10147 rtl8168_mdio_write(tp, 0x19, 0x405e);
10148 rtl8168_mdio_write(tp, 0x15, 0x03be);
10149 rtl8168_mdio_write(tp, 0x19, 0x44f8);
10150 rtl8168_mdio_write(tp, 0x15, 0x03bf);
10151 rtl8168_mdio_write(tp, 0x19, 0xd64f);
10152 rtl8168_mdio_write(tp, 0x15, 0x03c0);
10153 rtl8168_mdio_write(tp, 0x19, 0x0037);
10154 rtl8168_mdio_write(tp, 0x15, 0x03c1);
10155 rtl8168_mdio_write(tp, 0x19, 0xbd37);
10156 rtl8168_mdio_write(tp, 0x15, 0x03c2);
10157 rtl8168_mdio_write(tp, 0x19, 0x9cfd);
10158 rtl8168_mdio_write(tp, 0x15, 0x03c3);
10159 rtl8168_mdio_write(tp, 0x19, 0xc639);
10160 rtl8168_mdio_write(tp, 0x15, 0x03c4);
10161 rtl8168_mdio_write(tp, 0x19, 0x0011);
10162 rtl8168_mdio_write(tp, 0x15, 0x03c5);
10163 rtl8168_mdio_write(tp, 0x19, 0x9b03);
10164 rtl8168_mdio_write(tp, 0x15, 0x03c6);
10165 rtl8168_mdio_write(tp, 0x19, 0x7c01);
10166 rtl8168_mdio_write(tp, 0x15, 0x03c7);
10167 rtl8168_mdio_write(tp, 0x19, 0x4c01);
10168 rtl8168_mdio_write(tp, 0x15, 0x03c8);
10169 rtl8168_mdio_write(tp, 0x19, 0x9e03);
10170 rtl8168_mdio_write(tp, 0x15, 0x03c9);
10171 rtl8168_mdio_write(tp, 0x19, 0x7c20);
10172 rtl8168_mdio_write(tp, 0x15, 0x03ca);
10173 rtl8168_mdio_write(tp, 0x19, 0x4c20);
10174 rtl8168_mdio_write(tp, 0x15, 0x03cb);
10175 rtl8168_mdio_write(tp, 0x19, 0x9af4);
10176 rtl8168_mdio_write(tp, 0x15, 0x03cc);
10177 rtl8168_mdio_write(tp, 0x19, 0x7c12);
10178 rtl8168_mdio_write(tp, 0x15, 0x03cd);
10179 rtl8168_mdio_write(tp, 0x19, 0x4c52);
10180 rtl8168_mdio_write(tp, 0x15, 0x03ce);
10181 rtl8168_mdio_write(tp, 0x19, 0x4470);
10182 rtl8168_mdio_write(tp, 0x15, 0x03cf);
10183 rtl8168_mdio_write(tp, 0x19, 0x7c12);
10184 rtl8168_mdio_write(tp, 0x15, 0x03d0);
10185 rtl8168_mdio_write(tp, 0x19, 0x4c40);
10186 rtl8168_mdio_write(tp, 0x15, 0x03d1);
10187 rtl8168_mdio_write(tp, 0x19, 0x33bf);
10188 rtl8168_mdio_write(tp, 0x15, 0x03d6);
10189 rtl8168_mdio_write(tp, 0x19, 0x4047);
10190 rtl8168_mdio_write(tp, 0x15, 0x03d7);
10191 rtl8168_mdio_write(tp, 0x19, 0x4469);
10192 rtl8168_mdio_write(tp, 0x15, 0x03d8);
10193 rtl8168_mdio_write(tp, 0x19, 0x492b);
10194 rtl8168_mdio_write(tp, 0x15, 0x03d9);
10195 rtl8168_mdio_write(tp, 0x19, 0x4479);
10196 rtl8168_mdio_write(tp, 0x15, 0x03da);
10197 rtl8168_mdio_write(tp, 0x19, 0x7c09);
10198 rtl8168_mdio_write(tp, 0x15, 0x03db);
10199 rtl8168_mdio_write(tp, 0x19, 0x8203);
10200 rtl8168_mdio_write(tp, 0x15, 0x03dc);
10201 rtl8168_mdio_write(tp, 0x19, 0x4d48);
10202 rtl8168_mdio_write(tp, 0x15, 0x03dd);
10203 rtl8168_mdio_write(tp, 0x19, 0x33df);
10204 rtl8168_mdio_write(tp, 0x15, 0x03de);
10205 rtl8168_mdio_write(tp, 0x19, 0x4d40);
10206 rtl8168_mdio_write(tp, 0x15, 0x03df);
10207 rtl8168_mdio_write(tp, 0x19, 0xd64f);
10208 rtl8168_mdio_write(tp, 0x15, 0x03e0);
10209 rtl8168_mdio_write(tp, 0x19, 0x0017);
10210 rtl8168_mdio_write(tp, 0x15, 0x03e1);
10211 rtl8168_mdio_write(tp, 0x19, 0xbd17);
10212 rtl8168_mdio_write(tp, 0x15, 0x03e2);
10213 rtl8168_mdio_write(tp, 0x19, 0x9b03);
10214 rtl8168_mdio_write(tp, 0x15, 0x03e3);
10215 rtl8168_mdio_write(tp, 0x19, 0x7c20);
10216 rtl8168_mdio_write(tp, 0x15, 0x03e4);
10217 rtl8168_mdio_write(tp, 0x19, 0x4c20);
10218 rtl8168_mdio_write(tp, 0x15, 0x03e5);
10219 rtl8168_mdio_write(tp, 0x19, 0x88f5);
10220 rtl8168_mdio_write(tp, 0x15, 0x03e6);
10221 rtl8168_mdio_write(tp, 0x19, 0xc428);
10222 rtl8168_mdio_write(tp, 0x15, 0x03e7);
10223 rtl8168_mdio_write(tp, 0x19, 0x0008);
10224 rtl8168_mdio_write(tp, 0x15, 0x03e8);
10225 rtl8168_mdio_write(tp, 0x19, 0x9af2);
10226 rtl8168_mdio_write(tp, 0x15, 0x03e9);
10227 rtl8168_mdio_write(tp, 0x19, 0x7c12);
10228 rtl8168_mdio_write(tp, 0x15, 0x03ea);
10229 rtl8168_mdio_write(tp, 0x19, 0x4c52);
10230 rtl8168_mdio_write(tp, 0x15, 0x03eb);
10231 rtl8168_mdio_write(tp, 0x19, 0x4470);
10232 rtl8168_mdio_write(tp, 0x15, 0x03ec);
10233 rtl8168_mdio_write(tp, 0x19, 0x7c12);
10234 rtl8168_mdio_write(tp, 0x15, 0x03ed);
10235 rtl8168_mdio_write(tp, 0x19, 0x4c40);
10236 rtl8168_mdio_write(tp, 0x15, 0x03ee);
10237 rtl8168_mdio_write(tp, 0x19, 0x33da);
10238 rtl8168_mdio_write(tp, 0x15, 0x03ef);
10239 rtl8168_mdio_write(tp, 0x19, 0x3312);
10240 rtl8168_mdio_write(tp, 0x16, 0x0306);
10241 rtl8168_mdio_write(tp, 0x16, 0x0300);
10242 rtl8168_mdio_write(tp, 0x1f, 0x0000);
10243 rtl8168_mdio_write(tp, 0x17, 0x2179);
10244 rtl8168_mdio_write(tp, 0x1f, 0x0007);
10245 rtl8168_mdio_write(tp, 0x1e, 0x0040);
10246 rtl8168_mdio_write(tp, 0x18, 0x0645);
10247 rtl8168_mdio_write(tp, 0x19, 0xe200);
10248 rtl8168_mdio_write(tp, 0x18, 0x0655);
10249 rtl8168_mdio_write(tp, 0x19, 0x9000);
10250 rtl8168_mdio_write(tp, 0x18, 0x0d05);
10251 rtl8168_mdio_write(tp, 0x19, 0xbe00);
10252 rtl8168_mdio_write(tp, 0x18, 0x0d15);
10253 rtl8168_mdio_write(tp, 0x19, 0xd300);
10254 rtl8168_mdio_write(tp, 0x18, 0x0d25);
10255 rtl8168_mdio_write(tp, 0x19, 0xfe00);
10256 rtl8168_mdio_write(tp, 0x18, 0x0d35);
10257 rtl8168_mdio_write(tp, 0x19, 0x4000);
10258 rtl8168_mdio_write(tp, 0x18, 0x0d45);
10259 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10260 rtl8168_mdio_write(tp, 0x18, 0x0d55);
10261 rtl8168_mdio_write(tp, 0x19, 0x1000);
10262 rtl8168_mdio_write(tp, 0x18, 0x0d65);
10263 rtl8168_mdio_write(tp, 0x19, 0x0000);
10264 rtl8168_mdio_write(tp, 0x18, 0x0d75);
10265 rtl8168_mdio_write(tp, 0x19, 0x8200);
10266 rtl8168_mdio_write(tp, 0x18, 0x0d85);
10267 rtl8168_mdio_write(tp, 0x19, 0x0000);
10268 rtl8168_mdio_write(tp, 0x18, 0x0d95);
10269 rtl8168_mdio_write(tp, 0x19, 0x7000);
10270 rtl8168_mdio_write(tp, 0x18, 0x0da5);
10271 rtl8168_mdio_write(tp, 0x19, 0x0f00);
10272 rtl8168_mdio_write(tp, 0x18, 0x0db5);
10273 rtl8168_mdio_write(tp, 0x19, 0x0100);
10274 rtl8168_mdio_write(tp, 0x18, 0x0dc5);
10275 rtl8168_mdio_write(tp, 0x19, 0x9b00);
10276 rtl8168_mdio_write(tp, 0x18, 0x0dd5);
10277 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10278 rtl8168_mdio_write(tp, 0x18, 0x0de5);
10279 rtl8168_mdio_write(tp, 0x19, 0xe000);
10280 rtl8168_mdio_write(tp, 0x18, 0x0df5);
10281 rtl8168_mdio_write(tp, 0x19, 0xef00);
10282 rtl8168_mdio_write(tp, 0x18, 0x16d5);
10283 rtl8168_mdio_write(tp, 0x19, 0xe200);
10284 rtl8168_mdio_write(tp, 0x18, 0x16e5);
10285 rtl8168_mdio_write(tp, 0x19, 0xab00);
10286 rtl8168_mdio_write(tp, 0x18, 0x2904);
10287 rtl8168_mdio_write(tp, 0x19, 0x4000);
10288 rtl8168_mdio_write(tp, 0x18, 0x2914);
10289 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10290 rtl8168_mdio_write(tp, 0x18, 0x2924);
10291 rtl8168_mdio_write(tp, 0x19, 0x0100);
10292 rtl8168_mdio_write(tp, 0x18, 0x2934);
10293 rtl8168_mdio_write(tp, 0x19, 0x2000);
10294 rtl8168_mdio_write(tp, 0x18, 0x2944);
10295 rtl8168_mdio_write(tp, 0x19, 0x0000);
10296 rtl8168_mdio_write(tp, 0x18, 0x2954);
10297 rtl8168_mdio_write(tp, 0x19, 0x4600);
10298 rtl8168_mdio_write(tp, 0x18, 0x2964);
10299 rtl8168_mdio_write(tp, 0x19, 0xfc00);
10300 rtl8168_mdio_write(tp, 0x18, 0x2974);
10301 rtl8168_mdio_write(tp, 0x19, 0x0000);
10302 rtl8168_mdio_write(tp, 0x18, 0x2984);
10303 rtl8168_mdio_write(tp, 0x19, 0x5000);
10304 rtl8168_mdio_write(tp, 0x18, 0x2994);
10305 rtl8168_mdio_write(tp, 0x19, 0x9d00);
10306 rtl8168_mdio_write(tp, 0x18, 0x29a4);
10307 rtl8168_mdio_write(tp, 0x19, 0xff00);
10308 rtl8168_mdio_write(tp, 0x18, 0x29b4);
10309 rtl8168_mdio_write(tp, 0x19, 0x4000);
10310 rtl8168_mdio_write(tp, 0x18, 0x29c4);
10311 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10312 rtl8168_mdio_write(tp, 0x18, 0x29d4);
10313 rtl8168_mdio_write(tp, 0x19, 0x0000);
10314 rtl8168_mdio_write(tp, 0x18, 0x29e4);
10315 rtl8168_mdio_write(tp, 0x19, 0x2000);
10316 rtl8168_mdio_write(tp, 0x18, 0x29f4);
10317 rtl8168_mdio_write(tp, 0x19, 0x0000);
10318 rtl8168_mdio_write(tp, 0x18, 0x2a04);
10319 rtl8168_mdio_write(tp, 0x19, 0xe600);
10320 rtl8168_mdio_write(tp, 0x18, 0x2a14);
10321 rtl8168_mdio_write(tp, 0x19, 0xff00);
10322 rtl8168_mdio_write(tp, 0x18, 0x2a24);
10323 rtl8168_mdio_write(tp, 0x19, 0x0000);
10324 rtl8168_mdio_write(tp, 0x18, 0x2a34);
10325 rtl8168_mdio_write(tp, 0x19, 0x5000);
10326 rtl8168_mdio_write(tp, 0x18, 0x2a44);
10327 rtl8168_mdio_write(tp, 0x19, 0x8500);
10328 rtl8168_mdio_write(tp, 0x18, 0x2a54);
10329 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10330 rtl8168_mdio_write(tp, 0x18, 0x2a64);
10331 rtl8168_mdio_write(tp, 0x19, 0xac00);
10332 rtl8168_mdio_write(tp, 0x18, 0x2a74);
10333 rtl8168_mdio_write(tp, 0x19, 0x0800);
10334 rtl8168_mdio_write(tp, 0x18, 0x2a84);
10335 rtl8168_mdio_write(tp, 0x19, 0xfc00);
10336 rtl8168_mdio_write(tp, 0x18, 0x2a94);
10337 rtl8168_mdio_write(tp, 0x19, 0xe000);
10338 rtl8168_mdio_write(tp, 0x18, 0x2aa4);
10339 rtl8168_mdio_write(tp, 0x19, 0x7400);
10340 rtl8168_mdio_write(tp, 0x18, 0x2ab4);
10341 rtl8168_mdio_write(tp, 0x19, 0x4000);
10342 rtl8168_mdio_write(tp, 0x18, 0x2ac4);
10343 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10344 rtl8168_mdio_write(tp, 0x18, 0x2ad4);
10345 rtl8168_mdio_write(tp, 0x19, 0x0100);
10346 rtl8168_mdio_write(tp, 0x18, 0x2ae4);
10347 rtl8168_mdio_write(tp, 0x19, 0xff00);
10348 rtl8168_mdio_write(tp, 0x18, 0x2af4);
10349 rtl8168_mdio_write(tp, 0x19, 0x0000);
10350 rtl8168_mdio_write(tp, 0x18, 0x2b04);
10351 rtl8168_mdio_write(tp, 0x19, 0x4400);
10352 rtl8168_mdio_write(tp, 0x18, 0x2b14);
10353 rtl8168_mdio_write(tp, 0x19, 0xfc00);
10354 rtl8168_mdio_write(tp, 0x18, 0x2b24);
10355 rtl8168_mdio_write(tp, 0x19, 0x0000);
10356 rtl8168_mdio_write(tp, 0x18, 0x2b34);
10357 rtl8168_mdio_write(tp, 0x19, 0x4000);
10358 rtl8168_mdio_write(tp, 0x18, 0x2b44);
10359 rtl8168_mdio_write(tp, 0x19, 0x9d00);
10360 rtl8168_mdio_write(tp, 0x18, 0x2b54);
10361 rtl8168_mdio_write(tp, 0x19, 0xff00);
10362 rtl8168_mdio_write(tp, 0x18, 0x2b64);
10363 rtl8168_mdio_write(tp, 0x19, 0x4000);
10364 rtl8168_mdio_write(tp, 0x18, 0x2b74);
10365 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10366 rtl8168_mdio_write(tp, 0x18, 0x2b84);
10367 rtl8168_mdio_write(tp, 0x19, 0x0000);
10368 rtl8168_mdio_write(tp, 0x18, 0x2b94);
10369 rtl8168_mdio_write(tp, 0x19, 0xff00);
10370 rtl8168_mdio_write(tp, 0x18, 0x2ba4);
10371 rtl8168_mdio_write(tp, 0x19, 0x0000);
10372 rtl8168_mdio_write(tp, 0x18, 0x2bb4);
10373 rtl8168_mdio_write(tp, 0x19, 0xfc00);
10374 rtl8168_mdio_write(tp, 0x18, 0x2bc4);
10375 rtl8168_mdio_write(tp, 0x19, 0xff00);
10376 rtl8168_mdio_write(tp, 0x18, 0x2bd4);
10377 rtl8168_mdio_write(tp, 0x19, 0x0000);
10378 rtl8168_mdio_write(tp, 0x18, 0x2be4);
10379 rtl8168_mdio_write(tp, 0x19, 0x4000);
10380 rtl8168_mdio_write(tp, 0x18, 0x2bf4);
10381 rtl8168_mdio_write(tp, 0x19, 0x8900);
10382 rtl8168_mdio_write(tp, 0x18, 0x2c04);
10383 rtl8168_mdio_write(tp, 0x19, 0x8300);
10384 rtl8168_mdio_write(tp, 0x18, 0x2c14);
10385 rtl8168_mdio_write(tp, 0x19, 0xe000);
10386 rtl8168_mdio_write(tp, 0x18, 0x2c24);
10387 rtl8168_mdio_write(tp, 0x19, 0x0000);
10388 rtl8168_mdio_write(tp, 0x18, 0x2c34);
10389 rtl8168_mdio_write(tp, 0x19, 0xac00);
10390 rtl8168_mdio_write(tp, 0x18, 0x2c44);
10391 rtl8168_mdio_write(tp, 0x19, 0x0800);
10392 rtl8168_mdio_write(tp, 0x18, 0x2c54);
10393 rtl8168_mdio_write(tp, 0x19, 0xfa00);
10394 rtl8168_mdio_write(tp, 0x18, 0x2c64);
10395 rtl8168_mdio_write(tp, 0x19, 0xe100);
10396 rtl8168_mdio_write(tp, 0x18, 0x2c74);
10397 rtl8168_mdio_write(tp, 0x19, 0x7f00);
10398 rtl8168_mdio_write(tp, 0x18, 0x0001);
10399 rtl8168_mdio_write(tp, 0x1f, 0x0000);
10400 rtl8168_mdio_write(tp, 0x17, 0x2100);
10401 rtl8168_mdio_write(tp, 0x1f, 0x0005);
10402 rtl8168_mdio_write(tp, 0x05, 0xfff6);
10403 rtl8168_mdio_write(tp, 0x06, 0x0080);
10404 rtl8168_mdio_write(tp, 0x05, 0x8b88);
10405 rtl8168_mdio_write(tp, 0x06, 0x0000);
10406 rtl8168_mdio_write(tp, 0x06, 0x0000);
10407 rtl8168_mdio_write(tp, 0x06, 0x0000);
10408 rtl8168_mdio_write(tp, 0x06, 0x0000);
10409 rtl8168_mdio_write(tp, 0x05, 0x8000);
10410 rtl8168_mdio_write(tp, 0x06, 0xd480);
10411 rtl8168_mdio_write(tp, 0x06, 0xc1e4);
10412 rtl8168_mdio_write(tp, 0x06, 0x8b9a);
10413 rtl8168_mdio_write(tp, 0x06, 0xe58b);
10414 rtl8168_mdio_write(tp, 0x06, 0x9bee);
10415 rtl8168_mdio_write(tp, 0x06, 0x8b83);
10416 rtl8168_mdio_write(tp, 0x06, 0x41bf);
10417 rtl8168_mdio_write(tp, 0x06, 0x8b88);
10418 rtl8168_mdio_write(tp, 0x06, 0xec00);
10419 rtl8168_mdio_write(tp, 0x06, 0x19a9);
10420 rtl8168_mdio_write(tp, 0x06, 0x8b90);
10421 rtl8168_mdio_write(tp, 0x06, 0xf9ee);
10422 rtl8168_mdio_write(tp, 0x06, 0xfff6);
10423 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10424 rtl8168_mdio_write(tp, 0x06, 0xfff7);
10425 rtl8168_mdio_write(tp, 0x06, 0xffe0);
10426 rtl8168_mdio_write(tp, 0x06, 0xe140);
10427 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
10428 rtl8168_mdio_write(tp, 0x06, 0x41f7);
10429 rtl8168_mdio_write(tp, 0x06, 0x2ff6);
10430 rtl8168_mdio_write(tp, 0x06, 0x28e4);
10431 rtl8168_mdio_write(tp, 0x06, 0xe140);
10432 rtl8168_mdio_write(tp, 0x06, 0xe5e1);
10433 rtl8168_mdio_write(tp, 0x06, 0x41f7);
10434 rtl8168_mdio_write(tp, 0x06, 0x0002);
10435 rtl8168_mdio_write(tp, 0x06, 0x020c);
10436 rtl8168_mdio_write(tp, 0x06, 0x0202);
10437 rtl8168_mdio_write(tp, 0x06, 0x1d02);
10438 rtl8168_mdio_write(tp, 0x06, 0x0230);
10439 rtl8168_mdio_write(tp, 0x06, 0x0202);
10440 rtl8168_mdio_write(tp, 0x06, 0x4002);
10441 rtl8168_mdio_write(tp, 0x06, 0x028b);
10442 rtl8168_mdio_write(tp, 0x06, 0x0280);
10443 rtl8168_mdio_write(tp, 0x06, 0x6c02);
10444 rtl8168_mdio_write(tp, 0x06, 0x8085);
10445 rtl8168_mdio_write(tp, 0x06, 0xe08b);
10446 rtl8168_mdio_write(tp, 0x06, 0x88e1);
10447 rtl8168_mdio_write(tp, 0x06, 0x8b89);
10448 rtl8168_mdio_write(tp, 0x06, 0x1e01);
10449 rtl8168_mdio_write(tp, 0x06, 0xe18b);
10450 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
10451 rtl8168_mdio_write(tp, 0x06, 0x01e1);
10452 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
10453 rtl8168_mdio_write(tp, 0x06, 0x1e01);
10454 rtl8168_mdio_write(tp, 0x06, 0xe18b);
10455 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
10456 rtl8168_mdio_write(tp, 0x06, 0x01e1);
10457 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
10458 rtl8168_mdio_write(tp, 0x06, 0x1e01);
10459 rtl8168_mdio_write(tp, 0x06, 0xe18b);
10460 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
10461 rtl8168_mdio_write(tp, 0x06, 0x01a0);
10462 rtl8168_mdio_write(tp, 0x06, 0x00c7);
10463 rtl8168_mdio_write(tp, 0x06, 0xaec3);
10464 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
10465 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
10466 rtl8168_mdio_write(tp, 0x06, 0xad20);
10467 rtl8168_mdio_write(tp, 0x06, 0x10ee);
10468 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
10469 rtl8168_mdio_write(tp, 0x06, 0x0002);
10470 rtl8168_mdio_write(tp, 0x06, 0x1310);
10471 rtl8168_mdio_write(tp, 0x06, 0x021f);
10472 rtl8168_mdio_write(tp, 0x06, 0x9d02);
10473 rtl8168_mdio_write(tp, 0x06, 0x1f0c);
10474 rtl8168_mdio_write(tp, 0x06, 0x0227);
10475 rtl8168_mdio_write(tp, 0x06, 0x49fc);
10476 rtl8168_mdio_write(tp, 0x06, 0x04f8);
10477 rtl8168_mdio_write(tp, 0x06, 0xe08b);
10478 rtl8168_mdio_write(tp, 0x06, 0x8ead);
10479 rtl8168_mdio_write(tp, 0x06, 0x200b);
10480 rtl8168_mdio_write(tp, 0x06, 0xf620);
10481 rtl8168_mdio_write(tp, 0x06, 0xe48b);
10482 rtl8168_mdio_write(tp, 0x06, 0x8e02);
10483 rtl8168_mdio_write(tp, 0x06, 0x830e);
10484 rtl8168_mdio_write(tp, 0x06, 0x021b);
10485 rtl8168_mdio_write(tp, 0x06, 0x67ad);
10486 rtl8168_mdio_write(tp, 0x06, 0x2211);
10487 rtl8168_mdio_write(tp, 0x06, 0xf622);
10488 rtl8168_mdio_write(tp, 0x06, 0xe48b);
10489 rtl8168_mdio_write(tp, 0x06, 0x8e02);
10490 rtl8168_mdio_write(tp, 0x06, 0x2ba5);
10491 rtl8168_mdio_write(tp, 0x06, 0x022a);
10492 rtl8168_mdio_write(tp, 0x06, 0x2402);
10493 rtl8168_mdio_write(tp, 0x06, 0x80c6);
10494 rtl8168_mdio_write(tp, 0x06, 0x022a);
10495 rtl8168_mdio_write(tp, 0x06, 0xf0ad);
10496 rtl8168_mdio_write(tp, 0x06, 0x2511);
10497 rtl8168_mdio_write(tp, 0x06, 0xf625);
10498 rtl8168_mdio_write(tp, 0x06, 0xe48b);
10499 rtl8168_mdio_write(tp, 0x06, 0x8e02);
10500 rtl8168_mdio_write(tp, 0x06, 0x8226);
10501 rtl8168_mdio_write(tp, 0x06, 0x0204);
10502 rtl8168_mdio_write(tp, 0x06, 0x0302);
10503 rtl8168_mdio_write(tp, 0x06, 0x19cc);
10504 rtl8168_mdio_write(tp, 0x06, 0x022b);
10505 rtl8168_mdio_write(tp, 0x06, 0x5bfc);
10506 rtl8168_mdio_write(tp, 0x06, 0x04ee);
10507 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
10508 rtl8168_mdio_write(tp, 0x06, 0x0105);
10509 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
10510 rtl8168_mdio_write(tp, 0x06, 0x8b83);
10511 rtl8168_mdio_write(tp, 0x06, 0xad24);
10512 rtl8168_mdio_write(tp, 0x06, 0x44e0);
10513 rtl8168_mdio_write(tp, 0x06, 0xe022);
10514 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
10515 rtl8168_mdio_write(tp, 0x06, 0x23ad);
10516 rtl8168_mdio_write(tp, 0x06, 0x223b);
10517 rtl8168_mdio_write(tp, 0x06, 0xe08a);
10518 rtl8168_mdio_write(tp, 0x06, 0xbea0);
10519 rtl8168_mdio_write(tp, 0x06, 0x0005);
10520 rtl8168_mdio_write(tp, 0x06, 0x0228);
10521 rtl8168_mdio_write(tp, 0x06, 0xdeae);
10522 rtl8168_mdio_write(tp, 0x06, 0x42a0);
10523 rtl8168_mdio_write(tp, 0x06, 0x0105);
10524 rtl8168_mdio_write(tp, 0x06, 0x0228);
10525 rtl8168_mdio_write(tp, 0x06, 0xf1ae);
10526 rtl8168_mdio_write(tp, 0x06, 0x3aa0);
10527 rtl8168_mdio_write(tp, 0x06, 0x0205);
10528 rtl8168_mdio_write(tp, 0x06, 0x0281);
10529 rtl8168_mdio_write(tp, 0x06, 0x25ae);
10530 rtl8168_mdio_write(tp, 0x06, 0x32a0);
10531 rtl8168_mdio_write(tp, 0x06, 0x0305);
10532 rtl8168_mdio_write(tp, 0x06, 0x0229);
10533 rtl8168_mdio_write(tp, 0x06, 0x9aae);
10534 rtl8168_mdio_write(tp, 0x06, 0x2aa0);
10535 rtl8168_mdio_write(tp, 0x06, 0x0405);
10536 rtl8168_mdio_write(tp, 0x06, 0x0229);
10537 rtl8168_mdio_write(tp, 0x06, 0xaeae);
10538 rtl8168_mdio_write(tp, 0x06, 0x22a0);
10539 rtl8168_mdio_write(tp, 0x06, 0x0505);
10540 rtl8168_mdio_write(tp, 0x06, 0x0229);
10541 rtl8168_mdio_write(tp, 0x06, 0xd7ae);
10542 rtl8168_mdio_write(tp, 0x06, 0x1aa0);
10543 rtl8168_mdio_write(tp, 0x06, 0x0605);
10544 rtl8168_mdio_write(tp, 0x06, 0x0229);
10545 rtl8168_mdio_write(tp, 0x06, 0xfeae);
10546 rtl8168_mdio_write(tp, 0x06, 0x12ee);
10547 rtl8168_mdio_write(tp, 0x06, 0x8ac0);
10548 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10549 rtl8168_mdio_write(tp, 0x06, 0x8ac1);
10550 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10551 rtl8168_mdio_write(tp, 0x06, 0x8ac6);
10552 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10553 rtl8168_mdio_write(tp, 0x06, 0x8abe);
10554 rtl8168_mdio_write(tp, 0x06, 0x00ae);
10555 rtl8168_mdio_write(tp, 0x06, 0x00fc);
10556 rtl8168_mdio_write(tp, 0x06, 0x04f8);
10557 rtl8168_mdio_write(tp, 0x06, 0x022a);
10558 rtl8168_mdio_write(tp, 0x06, 0x67e0);
10559 rtl8168_mdio_write(tp, 0x06, 0xe022);
10560 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
10561 rtl8168_mdio_write(tp, 0x06, 0x230d);
10562 rtl8168_mdio_write(tp, 0x06, 0x0658);
10563 rtl8168_mdio_write(tp, 0x06, 0x03a0);
10564 rtl8168_mdio_write(tp, 0x06, 0x0202);
10565 rtl8168_mdio_write(tp, 0x06, 0xae2d);
10566 rtl8168_mdio_write(tp, 0x06, 0xa001);
10567 rtl8168_mdio_write(tp, 0x06, 0x02ae);
10568 rtl8168_mdio_write(tp, 0x06, 0x2da0);
10569 rtl8168_mdio_write(tp, 0x06, 0x004d);
10570 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
10571 rtl8168_mdio_write(tp, 0x06, 0x00e1);
10572 rtl8168_mdio_write(tp, 0x06, 0xe201);
10573 rtl8168_mdio_write(tp, 0x06, 0xad24);
10574 rtl8168_mdio_write(tp, 0x06, 0x44e0);
10575 rtl8168_mdio_write(tp, 0x06, 0x8ac2);
10576 rtl8168_mdio_write(tp, 0x06, 0xe48a);
10577 rtl8168_mdio_write(tp, 0x06, 0xc4e0);
10578 rtl8168_mdio_write(tp, 0x06, 0x8ac3);
10579 rtl8168_mdio_write(tp, 0x06, 0xe48a);
10580 rtl8168_mdio_write(tp, 0x06, 0xc5ee);
10581 rtl8168_mdio_write(tp, 0x06, 0x8abe);
10582 rtl8168_mdio_write(tp, 0x06, 0x03e0);
10583 rtl8168_mdio_write(tp, 0x06, 0x8b83);
10584 rtl8168_mdio_write(tp, 0x06, 0xad25);
10585 rtl8168_mdio_write(tp, 0x06, 0x3aee);
10586 rtl8168_mdio_write(tp, 0x06, 0x8abe);
10587 rtl8168_mdio_write(tp, 0x06, 0x05ae);
10588 rtl8168_mdio_write(tp, 0x06, 0x34e0);
10589 rtl8168_mdio_write(tp, 0x06, 0x8ace);
10590 rtl8168_mdio_write(tp, 0x06, 0xae03);
10591 rtl8168_mdio_write(tp, 0x06, 0xe08a);
10592 rtl8168_mdio_write(tp, 0x06, 0xcfe1);
10593 rtl8168_mdio_write(tp, 0x06, 0x8ac2);
10594 rtl8168_mdio_write(tp, 0x06, 0x4905);
10595 rtl8168_mdio_write(tp, 0x06, 0xe58a);
10596 rtl8168_mdio_write(tp, 0x06, 0xc4e1);
10597 rtl8168_mdio_write(tp, 0x06, 0x8ac3);
10598 rtl8168_mdio_write(tp, 0x06, 0x4905);
10599 rtl8168_mdio_write(tp, 0x06, 0xe58a);
10600 rtl8168_mdio_write(tp, 0x06, 0xc5ee);
10601 rtl8168_mdio_write(tp, 0x06, 0x8abe);
10602 rtl8168_mdio_write(tp, 0x06, 0x0502);
10603 rtl8168_mdio_write(tp, 0x06, 0x2ab6);
10604 rtl8168_mdio_write(tp, 0x06, 0xac20);
10605 rtl8168_mdio_write(tp, 0x06, 0x1202);
10606 rtl8168_mdio_write(tp, 0x06, 0x819b);
10607 rtl8168_mdio_write(tp, 0x06, 0xac20);
10608 rtl8168_mdio_write(tp, 0x06, 0x0cee);
10609 rtl8168_mdio_write(tp, 0x06, 0x8ac1);
10610 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10611 rtl8168_mdio_write(tp, 0x06, 0x8ac6);
10612 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10613 rtl8168_mdio_write(tp, 0x06, 0x8abe);
10614 rtl8168_mdio_write(tp, 0x06, 0x02fc);
10615 rtl8168_mdio_write(tp, 0x06, 0x04d0);
10616 rtl8168_mdio_write(tp, 0x06, 0x0002);
10617 rtl8168_mdio_write(tp, 0x06, 0x81ad);
10618 rtl8168_mdio_write(tp, 0x06, 0x590f);
10619 rtl8168_mdio_write(tp, 0x06, 0x3902);
10620 rtl8168_mdio_write(tp, 0x06, 0xaa04);
10621 rtl8168_mdio_write(tp, 0x06, 0xd001);
10622 rtl8168_mdio_write(tp, 0x06, 0xae02);
10623 rtl8168_mdio_write(tp, 0x06, 0xd000);
10624 rtl8168_mdio_write(tp, 0x06, 0x04f9);
10625 rtl8168_mdio_write(tp, 0x06, 0xfae2);
10626 rtl8168_mdio_write(tp, 0x06, 0xe2d2);
10627 rtl8168_mdio_write(tp, 0x06, 0xe3e2);
10628 rtl8168_mdio_write(tp, 0x06, 0xd3f9);
10629 rtl8168_mdio_write(tp, 0x06, 0x5af7);
10630 rtl8168_mdio_write(tp, 0x06, 0xe6e2);
10631 rtl8168_mdio_write(tp, 0x06, 0xd2e7);
10632 rtl8168_mdio_write(tp, 0x06, 0xe2d3);
10633 rtl8168_mdio_write(tp, 0x06, 0xe2e0);
10634 rtl8168_mdio_write(tp, 0x06, 0x2ce3);
10635 rtl8168_mdio_write(tp, 0x06, 0xe02d);
10636 rtl8168_mdio_write(tp, 0x06, 0xf95b);
10637 rtl8168_mdio_write(tp, 0x06, 0xe01e);
10638 rtl8168_mdio_write(tp, 0x06, 0x30e6);
10639 rtl8168_mdio_write(tp, 0x06, 0xe02c);
10640 rtl8168_mdio_write(tp, 0x06, 0xe7e0);
10641 rtl8168_mdio_write(tp, 0x06, 0x2de2);
10642 rtl8168_mdio_write(tp, 0x06, 0xe2cc);
10643 rtl8168_mdio_write(tp, 0x06, 0xe3e2);
10644 rtl8168_mdio_write(tp, 0x06, 0xcdf9);
10645 rtl8168_mdio_write(tp, 0x06, 0x5a0f);
10646 rtl8168_mdio_write(tp, 0x06, 0x6a50);
10647 rtl8168_mdio_write(tp, 0x06, 0xe6e2);
10648 rtl8168_mdio_write(tp, 0x06, 0xcce7);
10649 rtl8168_mdio_write(tp, 0x06, 0xe2cd);
10650 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
10651 rtl8168_mdio_write(tp, 0x06, 0x3ce1);
10652 rtl8168_mdio_write(tp, 0x06, 0xe03d);
10653 rtl8168_mdio_write(tp, 0x06, 0xef64);
10654 rtl8168_mdio_write(tp, 0x06, 0xfde0);
10655 rtl8168_mdio_write(tp, 0x06, 0xe2cc);
10656 rtl8168_mdio_write(tp, 0x06, 0xe1e2);
10657 rtl8168_mdio_write(tp, 0x06, 0xcd58);
10658 rtl8168_mdio_write(tp, 0x06, 0x0f5a);
10659 rtl8168_mdio_write(tp, 0x06, 0xf01e);
10660 rtl8168_mdio_write(tp, 0x06, 0x02e4);
10661 rtl8168_mdio_write(tp, 0x06, 0xe2cc);
10662 rtl8168_mdio_write(tp, 0x06, 0xe5e2);
10663 rtl8168_mdio_write(tp, 0x06, 0xcdfd);
10664 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
10665 rtl8168_mdio_write(tp, 0x06, 0x2ce1);
10666 rtl8168_mdio_write(tp, 0x06, 0xe02d);
10667 rtl8168_mdio_write(tp, 0x06, 0x59e0);
10668 rtl8168_mdio_write(tp, 0x06, 0x5b1f);
10669 rtl8168_mdio_write(tp, 0x06, 0x1e13);
10670 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
10671 rtl8168_mdio_write(tp, 0x06, 0x2ce5);
10672 rtl8168_mdio_write(tp, 0x06, 0xe02d);
10673 rtl8168_mdio_write(tp, 0x06, 0xfde0);
10674 rtl8168_mdio_write(tp, 0x06, 0xe2d2);
10675 rtl8168_mdio_write(tp, 0x06, 0xe1e2);
10676 rtl8168_mdio_write(tp, 0x06, 0xd358);
10677 rtl8168_mdio_write(tp, 0x06, 0xf75a);
10678 rtl8168_mdio_write(tp, 0x06, 0x081e);
10679 rtl8168_mdio_write(tp, 0x06, 0x02e4);
10680 rtl8168_mdio_write(tp, 0x06, 0xe2d2);
10681 rtl8168_mdio_write(tp, 0x06, 0xe5e2);
10682 rtl8168_mdio_write(tp, 0x06, 0xd3ef);
10683 rtl8168_mdio_write(tp, 0x06, 0x46fe);
10684 rtl8168_mdio_write(tp, 0x06, 0xfd04);
10685 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
10686 rtl8168_mdio_write(tp, 0x06, 0xfaef);
10687 rtl8168_mdio_write(tp, 0x06, 0x69e0);
10688 rtl8168_mdio_write(tp, 0x06, 0xe022);
10689 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
10690 rtl8168_mdio_write(tp, 0x06, 0x2358);
10691 rtl8168_mdio_write(tp, 0x06, 0xc4e1);
10692 rtl8168_mdio_write(tp, 0x06, 0x8b6e);
10693 rtl8168_mdio_write(tp, 0x06, 0x1f10);
10694 rtl8168_mdio_write(tp, 0x06, 0x9e58);
10695 rtl8168_mdio_write(tp, 0x06, 0xe48b);
10696 rtl8168_mdio_write(tp, 0x06, 0x6ead);
10697 rtl8168_mdio_write(tp, 0x06, 0x2222);
10698 rtl8168_mdio_write(tp, 0x06, 0xac27);
10699 rtl8168_mdio_write(tp, 0x06, 0x55ac);
10700 rtl8168_mdio_write(tp, 0x06, 0x2602);
10701 rtl8168_mdio_write(tp, 0x06, 0xae1a);
10702 rtl8168_mdio_write(tp, 0x06, 0xd106);
10703 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10704 rtl8168_mdio_write(tp, 0x06, 0xba02);
10705 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10706 rtl8168_mdio_write(tp, 0x06, 0xd107);
10707 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10708 rtl8168_mdio_write(tp, 0x06, 0xbd02);
10709 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10710 rtl8168_mdio_write(tp, 0x06, 0xd107);
10711 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10712 rtl8168_mdio_write(tp, 0x06, 0xc002);
10713 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10714 rtl8168_mdio_write(tp, 0x06, 0xae30);
10715 rtl8168_mdio_write(tp, 0x06, 0xd103);
10716 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10717 rtl8168_mdio_write(tp, 0x06, 0xc302);
10718 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10719 rtl8168_mdio_write(tp, 0x06, 0xd100);
10720 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10721 rtl8168_mdio_write(tp, 0x06, 0xc602);
10722 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10723 rtl8168_mdio_write(tp, 0x06, 0xd100);
10724 rtl8168_mdio_write(tp, 0x06, 0xbf82);
10725 rtl8168_mdio_write(tp, 0x06, 0xca02);
10726 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10727 rtl8168_mdio_write(tp, 0x06, 0xd10f);
10728 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10729 rtl8168_mdio_write(tp, 0x06, 0xba02);
10730 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10731 rtl8168_mdio_write(tp, 0x06, 0xd101);
10732 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10733 rtl8168_mdio_write(tp, 0x06, 0xbd02);
10734 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10735 rtl8168_mdio_write(tp, 0x06, 0xd101);
10736 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10737 rtl8168_mdio_write(tp, 0x06, 0xc002);
10738 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10739 rtl8168_mdio_write(tp, 0x06, 0xef96);
10740 rtl8168_mdio_write(tp, 0x06, 0xfefd);
10741 rtl8168_mdio_write(tp, 0x06, 0xfc04);
10742 rtl8168_mdio_write(tp, 0x06, 0xd100);
10743 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10744 rtl8168_mdio_write(tp, 0x06, 0xc302);
10745 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10746 rtl8168_mdio_write(tp, 0x06, 0xd011);
10747 rtl8168_mdio_write(tp, 0x06, 0x022b);
10748 rtl8168_mdio_write(tp, 0x06, 0xfb59);
10749 rtl8168_mdio_write(tp, 0x06, 0x03ef);
10750 rtl8168_mdio_write(tp, 0x06, 0x01d1);
10751 rtl8168_mdio_write(tp, 0x06, 0x00a0);
10752 rtl8168_mdio_write(tp, 0x06, 0x0002);
10753 rtl8168_mdio_write(tp, 0x06, 0xd101);
10754 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10755 rtl8168_mdio_write(tp, 0x06, 0xc602);
10756 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10757 rtl8168_mdio_write(tp, 0x06, 0xd111);
10758 rtl8168_mdio_write(tp, 0x06, 0xad20);
10759 rtl8168_mdio_write(tp, 0x06, 0x020c);
10760 rtl8168_mdio_write(tp, 0x06, 0x11ad);
10761 rtl8168_mdio_write(tp, 0x06, 0x2102);
10762 rtl8168_mdio_write(tp, 0x06, 0x0c12);
10763 rtl8168_mdio_write(tp, 0x06, 0xbf82);
10764 rtl8168_mdio_write(tp, 0x06, 0xca02);
10765 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10766 rtl8168_mdio_write(tp, 0x06, 0xaec8);
10767 rtl8168_mdio_write(tp, 0x06, 0x70e4);
10768 rtl8168_mdio_write(tp, 0x06, 0x2602);
10769 rtl8168_mdio_write(tp, 0x06, 0x82d1);
10770 rtl8168_mdio_write(tp, 0x06, 0x05f8);
10771 rtl8168_mdio_write(tp, 0x06, 0xfaef);
10772 rtl8168_mdio_write(tp, 0x06, 0x69e0);
10773 rtl8168_mdio_write(tp, 0x06, 0xe2fe);
10774 rtl8168_mdio_write(tp, 0x06, 0xe1e2);
10775 rtl8168_mdio_write(tp, 0x06, 0xffad);
10776 rtl8168_mdio_write(tp, 0x06, 0x2d1a);
10777 rtl8168_mdio_write(tp, 0x06, 0xe0e1);
10778 rtl8168_mdio_write(tp, 0x06, 0x4ee1);
10779 rtl8168_mdio_write(tp, 0x06, 0xe14f);
10780 rtl8168_mdio_write(tp, 0x06, 0xac2d);
10781 rtl8168_mdio_write(tp, 0x06, 0x22f6);
10782 rtl8168_mdio_write(tp, 0x06, 0x0302);
10783 rtl8168_mdio_write(tp, 0x06, 0x033b);
10784 rtl8168_mdio_write(tp, 0x06, 0xf703);
10785 rtl8168_mdio_write(tp, 0x06, 0xf706);
10786 rtl8168_mdio_write(tp, 0x06, 0xbf84);
10787 rtl8168_mdio_write(tp, 0x06, 0x4402);
10788 rtl8168_mdio_write(tp, 0x06, 0x2d21);
10789 rtl8168_mdio_write(tp, 0x06, 0xae11);
10790 rtl8168_mdio_write(tp, 0x06, 0xe0e1);
10791 rtl8168_mdio_write(tp, 0x06, 0x4ee1);
10792 rtl8168_mdio_write(tp, 0x06, 0xe14f);
10793 rtl8168_mdio_write(tp, 0x06, 0xad2d);
10794 rtl8168_mdio_write(tp, 0x06, 0x08bf);
10795 rtl8168_mdio_write(tp, 0x06, 0x844f);
10796 rtl8168_mdio_write(tp, 0x06, 0x022d);
10797 rtl8168_mdio_write(tp, 0x06, 0x21f6);
10798 rtl8168_mdio_write(tp, 0x06, 0x06ef);
10799 rtl8168_mdio_write(tp, 0x06, 0x96fe);
10800 rtl8168_mdio_write(tp, 0x06, 0xfc04);
10801 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
10802 rtl8168_mdio_write(tp, 0x06, 0xef69);
10803 rtl8168_mdio_write(tp, 0x06, 0x0283);
10804 rtl8168_mdio_write(tp, 0x06, 0x4502);
10805 rtl8168_mdio_write(tp, 0x06, 0x83a2);
10806 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
10807 rtl8168_mdio_write(tp, 0x06, 0x00e1);
10808 rtl8168_mdio_write(tp, 0x06, 0xe001);
10809 rtl8168_mdio_write(tp, 0x06, 0xad27);
10810 rtl8168_mdio_write(tp, 0x06, 0x1fd1);
10811 rtl8168_mdio_write(tp, 0x06, 0x01bf);
10812 rtl8168_mdio_write(tp, 0x06, 0x843b);
10813 rtl8168_mdio_write(tp, 0x06, 0x022d);
10814 rtl8168_mdio_write(tp, 0x06, 0xc1e0);
10815 rtl8168_mdio_write(tp, 0x06, 0xe020);
10816 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
10817 rtl8168_mdio_write(tp, 0x06, 0x21ad);
10818 rtl8168_mdio_write(tp, 0x06, 0x200e);
10819 rtl8168_mdio_write(tp, 0x06, 0xd100);
10820 rtl8168_mdio_write(tp, 0x06, 0xbf84);
10821 rtl8168_mdio_write(tp, 0x06, 0x3b02);
10822 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10823 rtl8168_mdio_write(tp, 0x06, 0xbf3b);
10824 rtl8168_mdio_write(tp, 0x06, 0x9602);
10825 rtl8168_mdio_write(tp, 0x06, 0x2d21);
10826 rtl8168_mdio_write(tp, 0x06, 0xef96);
10827 rtl8168_mdio_write(tp, 0x06, 0xfefc);
10828 rtl8168_mdio_write(tp, 0x06, 0x04f8);
10829 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
10830 rtl8168_mdio_write(tp, 0x06, 0xef69);
10831 rtl8168_mdio_write(tp, 0x06, 0xe08b);
10832 rtl8168_mdio_write(tp, 0x06, 0x87ad);
10833 rtl8168_mdio_write(tp, 0x06, 0x204c);
10834 rtl8168_mdio_write(tp, 0x06, 0xd200);
10835 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
10836 rtl8168_mdio_write(tp, 0x06, 0x0058);
10837 rtl8168_mdio_write(tp, 0x06, 0x010c);
10838 rtl8168_mdio_write(tp, 0x06, 0x021e);
10839 rtl8168_mdio_write(tp, 0x06, 0x20e0);
10840 rtl8168_mdio_write(tp, 0x06, 0xe000);
10841 rtl8168_mdio_write(tp, 0x06, 0x5810);
10842 rtl8168_mdio_write(tp, 0x06, 0x1e20);
10843 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
10844 rtl8168_mdio_write(tp, 0x06, 0x3658);
10845 rtl8168_mdio_write(tp, 0x06, 0x031e);
10846 rtl8168_mdio_write(tp, 0x06, 0x20e0);
10847 rtl8168_mdio_write(tp, 0x06, 0xe022);
10848 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
10849 rtl8168_mdio_write(tp, 0x06, 0x2358);
10850 rtl8168_mdio_write(tp, 0x06, 0xe01e);
10851 rtl8168_mdio_write(tp, 0x06, 0x20e0);
10852 rtl8168_mdio_write(tp, 0x06, 0x8b64);
10853 rtl8168_mdio_write(tp, 0x06, 0x1f02);
10854 rtl8168_mdio_write(tp, 0x06, 0x9e22);
10855 rtl8168_mdio_write(tp, 0x06, 0xe68b);
10856 rtl8168_mdio_write(tp, 0x06, 0x64ad);
10857 rtl8168_mdio_write(tp, 0x06, 0x3214);
10858 rtl8168_mdio_write(tp, 0x06, 0xad34);
10859 rtl8168_mdio_write(tp, 0x06, 0x11ef);
10860 rtl8168_mdio_write(tp, 0x06, 0x0258);
10861 rtl8168_mdio_write(tp, 0x06, 0x039e);
10862 rtl8168_mdio_write(tp, 0x06, 0x07ad);
10863 rtl8168_mdio_write(tp, 0x06, 0x3508);
10864 rtl8168_mdio_write(tp, 0x06, 0x5ac0);
10865 rtl8168_mdio_write(tp, 0x06, 0x9f04);
10866 rtl8168_mdio_write(tp, 0x06, 0xd101);
10867 rtl8168_mdio_write(tp, 0x06, 0xae02);
10868 rtl8168_mdio_write(tp, 0x06, 0xd100);
10869 rtl8168_mdio_write(tp, 0x06, 0xbf84);
10870 rtl8168_mdio_write(tp, 0x06, 0x3e02);
10871 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10872 rtl8168_mdio_write(tp, 0x06, 0xef96);
10873 rtl8168_mdio_write(tp, 0x06, 0xfefd);
10874 rtl8168_mdio_write(tp, 0x06, 0xfc04);
10875 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
10876 rtl8168_mdio_write(tp, 0x06, 0xfbe0);
10877 rtl8168_mdio_write(tp, 0x06, 0x8b85);
10878 rtl8168_mdio_write(tp, 0x06, 0xad25);
10879 rtl8168_mdio_write(tp, 0x06, 0x22e0);
10880 rtl8168_mdio_write(tp, 0x06, 0xe022);
10881 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
10882 rtl8168_mdio_write(tp, 0x06, 0x23e2);
10883 rtl8168_mdio_write(tp, 0x06, 0xe036);
10884 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
10885 rtl8168_mdio_write(tp, 0x06, 0x375a);
10886 rtl8168_mdio_write(tp, 0x06, 0xc40d);
10887 rtl8168_mdio_write(tp, 0x06, 0x0158);
10888 rtl8168_mdio_write(tp, 0x06, 0x021e);
10889 rtl8168_mdio_write(tp, 0x06, 0x20e3);
10890 rtl8168_mdio_write(tp, 0x06, 0x8ae7);
10891 rtl8168_mdio_write(tp, 0x06, 0xac31);
10892 rtl8168_mdio_write(tp, 0x06, 0x60ac);
10893 rtl8168_mdio_write(tp, 0x06, 0x3a08);
10894 rtl8168_mdio_write(tp, 0x06, 0xac3e);
10895 rtl8168_mdio_write(tp, 0x06, 0x26ae);
10896 rtl8168_mdio_write(tp, 0x06, 0x67af);
10897 rtl8168_mdio_write(tp, 0x06, 0x8437);
10898 rtl8168_mdio_write(tp, 0x06, 0xad37);
10899 rtl8168_mdio_write(tp, 0x06, 0x61e0);
10900 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
10901 rtl8168_mdio_write(tp, 0x06, 0x10e4);
10902 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
10903 rtl8168_mdio_write(tp, 0x06, 0xe18a);
10904 rtl8168_mdio_write(tp, 0x06, 0xe91b);
10905 rtl8168_mdio_write(tp, 0x06, 0x109e);
10906 rtl8168_mdio_write(tp, 0x06, 0x02ae);
10907 rtl8168_mdio_write(tp, 0x06, 0x51d1);
10908 rtl8168_mdio_write(tp, 0x06, 0x00bf);
10909 rtl8168_mdio_write(tp, 0x06, 0x8441);
10910 rtl8168_mdio_write(tp, 0x06, 0x022d);
10911 rtl8168_mdio_write(tp, 0x06, 0xc1ee);
10912 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
10913 rtl8168_mdio_write(tp, 0x06, 0x00ae);
10914 rtl8168_mdio_write(tp, 0x06, 0x43ad);
10915 rtl8168_mdio_write(tp, 0x06, 0x3627);
10916 rtl8168_mdio_write(tp, 0x06, 0xe08a);
10917 rtl8168_mdio_write(tp, 0x06, 0xeee1);
10918 rtl8168_mdio_write(tp, 0x06, 0x8aef);
10919 rtl8168_mdio_write(tp, 0x06, 0xef74);
10920 rtl8168_mdio_write(tp, 0x06, 0xe08a);
10921 rtl8168_mdio_write(tp, 0x06, 0xeae1);
10922 rtl8168_mdio_write(tp, 0x06, 0x8aeb);
10923 rtl8168_mdio_write(tp, 0x06, 0x1b74);
10924 rtl8168_mdio_write(tp, 0x06, 0x9e2e);
10925 rtl8168_mdio_write(tp, 0x06, 0x14e4);
10926 rtl8168_mdio_write(tp, 0x06, 0x8aea);
10927 rtl8168_mdio_write(tp, 0x06, 0xe58a);
10928 rtl8168_mdio_write(tp, 0x06, 0xebef);
10929 rtl8168_mdio_write(tp, 0x06, 0x74e0);
10930 rtl8168_mdio_write(tp, 0x06, 0x8aee);
10931 rtl8168_mdio_write(tp, 0x06, 0xe18a);
10932 rtl8168_mdio_write(tp, 0x06, 0xef1b);
10933 rtl8168_mdio_write(tp, 0x06, 0x479e);
10934 rtl8168_mdio_write(tp, 0x06, 0x0fae);
10935 rtl8168_mdio_write(tp, 0x06, 0x19ee);
10936 rtl8168_mdio_write(tp, 0x06, 0x8aea);
10937 rtl8168_mdio_write(tp, 0x06, 0x00ee);
10938 rtl8168_mdio_write(tp, 0x06, 0x8aeb);
10939 rtl8168_mdio_write(tp, 0x06, 0x00ae);
10940 rtl8168_mdio_write(tp, 0x06, 0x0fac);
10941 rtl8168_mdio_write(tp, 0x06, 0x390c);
10942 rtl8168_mdio_write(tp, 0x06, 0xd101);
10943 rtl8168_mdio_write(tp, 0x06, 0xbf84);
10944 rtl8168_mdio_write(tp, 0x06, 0x4102);
10945 rtl8168_mdio_write(tp, 0x06, 0x2dc1);
10946 rtl8168_mdio_write(tp, 0x06, 0xee8a);
10947 rtl8168_mdio_write(tp, 0x06, 0xe800);
10948 rtl8168_mdio_write(tp, 0x06, 0xe68a);
10949 rtl8168_mdio_write(tp, 0x06, 0xe7ff);
10950 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
10951 rtl8168_mdio_write(tp, 0x06, 0x0400);
10952 rtl8168_mdio_write(tp, 0x06, 0xe234);
10953 rtl8168_mdio_write(tp, 0x06, 0xcce2);
10954 rtl8168_mdio_write(tp, 0x06, 0x0088);
10955 rtl8168_mdio_write(tp, 0x06, 0xe200);
10956 rtl8168_mdio_write(tp, 0x06, 0xa725);
10957 rtl8168_mdio_write(tp, 0x06, 0xe50a);
10958 rtl8168_mdio_write(tp, 0x06, 0x1de5);
10959 rtl8168_mdio_write(tp, 0x06, 0x0a2c);
10960 rtl8168_mdio_write(tp, 0x06, 0xe50a);
10961 rtl8168_mdio_write(tp, 0x06, 0x6de5);
10962 rtl8168_mdio_write(tp, 0x06, 0x0a1d);
10963 rtl8168_mdio_write(tp, 0x06, 0xe50a);
10964 rtl8168_mdio_write(tp, 0x06, 0x1ce5);
10965 rtl8168_mdio_write(tp, 0x06, 0x0a2d);
10966 rtl8168_mdio_write(tp, 0x06, 0xa755);
10967 rtl8168_mdio_write(tp, 0x05, 0x8b64);
10968 rtl8168_mdio_write(tp, 0x06, 0x0000);
10969 rtl8168_mdio_write(tp, 0x05, 0x8b94);
10970 rtl8168_mdio_write(tp, 0x06, 0x82cd);
10971 rtl8168_mdio_write(tp, 0x05, 0x8b85);
10972 rtl8168_mdio_write(tp, 0x06, 0x2000);
10973 rtl8168_mdio_write(tp, 0x05, 0x8aee);
10974 rtl8168_mdio_write(tp, 0x06, 0x03b8);
10975 rtl8168_mdio_write(tp, 0x05, 0x8ae8);
10976 rtl8168_mdio_write(tp, 0x06, 0x0002);
10977 gphy_val = rtl8168_mdio_read(tp, 0x01);
10978 gphy_val |= BIT_0;
10979 rtl8168_mdio_write(tp, 0x01, gphy_val);
10980 gphy_val = rtl8168_mdio_read(tp, 0x00);
10981 gphy_val |= BIT_0;
10982 rtl8168_mdio_write(tp, 0x00, gphy_val);
10983 rtl8168_mdio_write(tp, 0x1f, 0x0000);
10984 rtl8168_mdio_write(tp, 0x1f, 0x0005);
10985 for (i = 0; i < 200; i++) {
10986 udelay(100);
10987 gphy_val = rtl8168_mdio_read(tp, 0x00);
10988 if (gphy_val & BIT_7)
10989 break;
10990 }
10991 rtl8168_mdio_write(tp, 0x1f, 0x0007);
10992 rtl8168_mdio_write(tp, 0x1e, 0x0023);
10993 gphy_val = rtl8168_mdio_read(tp, 0x17);
10994 gphy_val &= ~(BIT_0);
10995 if (tp->RequiredSecLanDonglePatch)
10996 gphy_val &= ~(BIT_2);
10997 rtl8168_mdio_write(tp, 0x17, gphy_val);
10998 rtl8168_mdio_write(tp, 0x1f, 0x0007);
10999 rtl8168_mdio_write(tp, 0x1e, 0x0028);
11000 rtl8168_mdio_write(tp, 0x15, 0x0010);
11001 rtl8168_mdio_write(tp, 0x1f, 0x0007);
11002 rtl8168_mdio_write(tp, 0x1e, 0x0041);
11003 rtl8168_mdio_write(tp, 0x15, 0x0802);
11004 rtl8168_mdio_write(tp, 0x16, 0x2185);
11005 rtl8168_mdio_write(tp, 0x1f, 0x0000);
11006 }
11007
11008 static void
rtl8168_set_phy_mcu_8168e_2(struct net_device * dev)11009 rtl8168_set_phy_mcu_8168e_2(struct net_device *dev)
11010 {
11011 struct rtl8168_private *tp = netdev_priv(dev);
11012 unsigned int gphy_val,i;
11013
11014 if (rtl8168_efuse_read(tp, 0x22) == 0x0c) {
11015 rtl8168_mdio_write(tp, 0x1f, 0x0000);
11016 rtl8168_mdio_write(tp, 0x00, 0x1800);
11017 rtl8168_mdio_write(tp, 0x1f, 0x0007);
11018 rtl8168_mdio_write(tp, 0x1e, 0x0023);
11019 rtl8168_mdio_write(tp, 0x17, 0x0117);
11020 rtl8168_mdio_write(tp, 0x1f, 0x0007);
11021 rtl8168_mdio_write(tp, 0x1E, 0x002C);
11022 rtl8168_mdio_write(tp, 0x1B, 0x5000);
11023 rtl8168_mdio_write(tp, 0x1f, 0x0000);
11024 rtl8168_mdio_write(tp, 0x16, 0x4104);
11025 for (i = 0; i < 200; i++) {
11026 udelay(100);
11027 gphy_val = rtl8168_mdio_read(tp, 0x1E);
11028 gphy_val &= 0x03FF;
11029 if (gphy_val==0x000C)
11030 break;
11031 }
11032 rtl8168_mdio_write(tp, 0x1f, 0x0005);
11033 for (i = 0; i < 200; i++) {
11034 udelay(100);
11035 gphy_val = rtl8168_mdio_read(tp, 0x07);
11036 if ((gphy_val & BIT_5) == 0)
11037 break;
11038 }
11039 gphy_val = rtl8168_mdio_read(tp, 0x07);
11040 if (gphy_val & BIT_5) {
11041 rtl8168_mdio_write(tp, 0x1f, 0x0007);
11042 rtl8168_mdio_write(tp, 0x1e, 0x00a1);
11043 rtl8168_mdio_write(tp, 0x17, 0x1000);
11044 rtl8168_mdio_write(tp, 0x17, 0x0000);
11045 rtl8168_mdio_write(tp, 0x17, 0x2000);
11046 rtl8168_mdio_write(tp, 0x1e, 0x002f);
11047 rtl8168_mdio_write(tp, 0x18, 0x9bfb);
11048 rtl8168_mdio_write(tp, 0x1f, 0x0005);
11049 rtl8168_mdio_write(tp, 0x07, 0x0000);
11050 rtl8168_mdio_write(tp, 0x1f, 0x0000);
11051 }
11052 rtl8168_mdio_write(tp, 0x1f, 0x0005);
11053 rtl8168_mdio_write(tp, 0x05, 0xfff6);
11054 rtl8168_mdio_write(tp, 0x06, 0x0080);
11055 gphy_val = rtl8168_mdio_read(tp, 0x00);
11056 gphy_val &= ~(BIT_7);
11057 rtl8168_mdio_write(tp, 0x00, gphy_val);
11058 rtl8168_mdio_write(tp, 0x1f, 0x0002);
11059 gphy_val = rtl8168_mdio_read(tp, 0x08);
11060 gphy_val &= ~(BIT_7);
11061 rtl8168_mdio_write(tp, 0x08, gphy_val);
11062 rtl8168_mdio_write(tp, 0x1f, 0x0000);
11063
11064 rtl8168_mdio_write(tp, 0x1f, 0x0007);
11065 rtl8168_mdio_write(tp, 0x1e, 0x0023);
11066 rtl8168_mdio_write(tp, 0x16, 0x0306);
11067 rtl8168_mdio_write(tp, 0x16, 0x0307);
11068 rtl8168_mdio_write(tp, 0x15, 0x000e);
11069 rtl8168_mdio_write(tp, 0x19, 0x000a);
11070 rtl8168_mdio_write(tp, 0x15, 0x0010);
11071 rtl8168_mdio_write(tp, 0x19, 0x0008);
11072 rtl8168_mdio_write(tp, 0x15, 0x0018);
11073 rtl8168_mdio_write(tp, 0x19, 0x4801);
11074 rtl8168_mdio_write(tp, 0x15, 0x0019);
11075 rtl8168_mdio_write(tp, 0x19, 0x6801);
11076 rtl8168_mdio_write(tp, 0x15, 0x001a);
11077 rtl8168_mdio_write(tp, 0x19, 0x66a1);
11078 rtl8168_mdio_write(tp, 0x15, 0x001f);
11079 rtl8168_mdio_write(tp, 0x19, 0x0000);
11080 rtl8168_mdio_write(tp, 0x15, 0x0020);
11081 rtl8168_mdio_write(tp, 0x19, 0x0000);
11082 rtl8168_mdio_write(tp, 0x15, 0x0021);
11083 rtl8168_mdio_write(tp, 0x19, 0x0000);
11084 rtl8168_mdio_write(tp, 0x15, 0x0022);
11085 rtl8168_mdio_write(tp, 0x19, 0x0000);
11086 rtl8168_mdio_write(tp, 0x15, 0x0023);
11087 rtl8168_mdio_write(tp, 0x19, 0x0000);
11088 rtl8168_mdio_write(tp, 0x15, 0x0024);
11089 rtl8168_mdio_write(tp, 0x19, 0x0000);
11090 rtl8168_mdio_write(tp, 0x15, 0x0025);
11091 rtl8168_mdio_write(tp, 0x19, 0x64a1);
11092 rtl8168_mdio_write(tp, 0x15, 0x0026);
11093 rtl8168_mdio_write(tp, 0x19, 0x40ea);
11094 rtl8168_mdio_write(tp, 0x15, 0x0027);
11095 rtl8168_mdio_write(tp, 0x19, 0x4503);
11096 rtl8168_mdio_write(tp, 0x15, 0x0028);
11097 rtl8168_mdio_write(tp, 0x19, 0x9f00);
11098 rtl8168_mdio_write(tp, 0x15, 0x0029);
11099 rtl8168_mdio_write(tp, 0x19, 0xa631);
11100 rtl8168_mdio_write(tp, 0x15, 0x002a);
11101 rtl8168_mdio_write(tp, 0x19, 0x9717);
11102 rtl8168_mdio_write(tp, 0x15, 0x002b);
11103 rtl8168_mdio_write(tp, 0x19, 0x302c);
11104 rtl8168_mdio_write(tp, 0x15, 0x002c);
11105 rtl8168_mdio_write(tp, 0x19, 0x4802);
11106 rtl8168_mdio_write(tp, 0x15, 0x002d);
11107 rtl8168_mdio_write(tp, 0x19, 0x58da);
11108 rtl8168_mdio_write(tp, 0x15, 0x002e);
11109 rtl8168_mdio_write(tp, 0x19, 0x400d);
11110 rtl8168_mdio_write(tp, 0x15, 0x002f);
11111 rtl8168_mdio_write(tp, 0x19, 0x4488);
11112 rtl8168_mdio_write(tp, 0x15, 0x0030);
11113 rtl8168_mdio_write(tp, 0x19, 0x9e00);
11114 rtl8168_mdio_write(tp, 0x15, 0x0031);
11115 rtl8168_mdio_write(tp, 0x19, 0x63c8);
11116 rtl8168_mdio_write(tp, 0x15, 0x0032);
11117 rtl8168_mdio_write(tp, 0x19, 0x6481);
11118 rtl8168_mdio_write(tp, 0x15, 0x0033);
11119 rtl8168_mdio_write(tp, 0x19, 0x0000);
11120 rtl8168_mdio_write(tp, 0x15, 0x0034);
11121 rtl8168_mdio_write(tp, 0x19, 0x0000);
11122 rtl8168_mdio_write(tp, 0x15, 0x0035);
11123 rtl8168_mdio_write(tp, 0x19, 0x0000);
11124 rtl8168_mdio_write(tp, 0x15, 0x0036);
11125 rtl8168_mdio_write(tp, 0x19, 0x0000);
11126 rtl8168_mdio_write(tp, 0x15, 0x0037);
11127 rtl8168_mdio_write(tp, 0x19, 0x0000);
11128 rtl8168_mdio_write(tp, 0x15, 0x0038);
11129 rtl8168_mdio_write(tp, 0x19, 0x0000);
11130 rtl8168_mdio_write(tp, 0x15, 0x0039);
11131 rtl8168_mdio_write(tp, 0x19, 0x0000);
11132 rtl8168_mdio_write(tp, 0x15, 0x003a);
11133 rtl8168_mdio_write(tp, 0x19, 0x0000);
11134 rtl8168_mdio_write(tp, 0x15, 0x003b);
11135 rtl8168_mdio_write(tp, 0x19, 0x63e8);
11136 rtl8168_mdio_write(tp, 0x15, 0x003c);
11137 rtl8168_mdio_write(tp, 0x19, 0x7d00);
11138 rtl8168_mdio_write(tp, 0x15, 0x003d);
11139 rtl8168_mdio_write(tp, 0x19, 0x59d4);
11140 rtl8168_mdio_write(tp, 0x15, 0x003e);
11141 rtl8168_mdio_write(tp, 0x19, 0x63f8);
11142 rtl8168_mdio_write(tp, 0x15, 0x0040);
11143 rtl8168_mdio_write(tp, 0x19, 0x64a1);
11144 rtl8168_mdio_write(tp, 0x15, 0x0041);
11145 rtl8168_mdio_write(tp, 0x19, 0x30de);
11146 rtl8168_mdio_write(tp, 0x15, 0x0044);
11147 rtl8168_mdio_write(tp, 0x19, 0x480f);
11148 rtl8168_mdio_write(tp, 0x15, 0x0045);
11149 rtl8168_mdio_write(tp, 0x19, 0x6800);
11150 rtl8168_mdio_write(tp, 0x15, 0x0046);
11151 rtl8168_mdio_write(tp, 0x19, 0x6680);
11152 rtl8168_mdio_write(tp, 0x15, 0x0047);
11153 rtl8168_mdio_write(tp, 0x19, 0x7c10);
11154 rtl8168_mdio_write(tp, 0x15, 0x0048);
11155 rtl8168_mdio_write(tp, 0x19, 0x63c8);
11156 rtl8168_mdio_write(tp, 0x15, 0x0049);
11157 rtl8168_mdio_write(tp, 0x19, 0x0000);
11158 rtl8168_mdio_write(tp, 0x15, 0x004a);
11159 rtl8168_mdio_write(tp, 0x19, 0x0000);
11160 rtl8168_mdio_write(tp, 0x15, 0x004b);
11161 rtl8168_mdio_write(tp, 0x19, 0x0000);
11162 rtl8168_mdio_write(tp, 0x15, 0x004c);
11163 rtl8168_mdio_write(tp, 0x19, 0x0000);
11164 rtl8168_mdio_write(tp, 0x15, 0x004d);
11165 rtl8168_mdio_write(tp, 0x19, 0x0000);
11166 rtl8168_mdio_write(tp, 0x15, 0x004e);
11167 rtl8168_mdio_write(tp, 0x19, 0x0000);
11168 rtl8168_mdio_write(tp, 0x15, 0x004f);
11169 rtl8168_mdio_write(tp, 0x19, 0x40ea);
11170 rtl8168_mdio_write(tp, 0x15, 0x0050);
11171 rtl8168_mdio_write(tp, 0x19, 0x4503);
11172 rtl8168_mdio_write(tp, 0x15, 0x0051);
11173 rtl8168_mdio_write(tp, 0x19, 0x58ca);
11174 rtl8168_mdio_write(tp, 0x15, 0x0052);
11175 rtl8168_mdio_write(tp, 0x19, 0x63c8);
11176 rtl8168_mdio_write(tp, 0x15, 0x0053);
11177 rtl8168_mdio_write(tp, 0x19, 0x63d8);
11178 rtl8168_mdio_write(tp, 0x15, 0x0054);
11179 rtl8168_mdio_write(tp, 0x19, 0x66a0);
11180 rtl8168_mdio_write(tp, 0x15, 0x0055);
11181 rtl8168_mdio_write(tp, 0x19, 0x9f00);
11182 rtl8168_mdio_write(tp, 0x15, 0x0056);
11183 rtl8168_mdio_write(tp, 0x19, 0x3000);
11184 rtl8168_mdio_write(tp, 0x15, 0x00a1);
11185 rtl8168_mdio_write(tp, 0x19, 0x3044);
11186 rtl8168_mdio_write(tp, 0x15, 0x00ab);
11187 rtl8168_mdio_write(tp, 0x19, 0x5820);
11188 rtl8168_mdio_write(tp, 0x15, 0x00ac);
11189 rtl8168_mdio_write(tp, 0x19, 0x5e04);
11190 rtl8168_mdio_write(tp, 0x15, 0x00ad);
11191 rtl8168_mdio_write(tp, 0x19, 0xb60c);
11192 rtl8168_mdio_write(tp, 0x15, 0x00af);
11193 rtl8168_mdio_write(tp, 0x19, 0x000a);
11194 rtl8168_mdio_write(tp, 0x15, 0x00b2);
11195 rtl8168_mdio_write(tp, 0x19, 0x30b9);
11196 rtl8168_mdio_write(tp, 0x15, 0x00b9);
11197 rtl8168_mdio_write(tp, 0x19, 0x4408);
11198 rtl8168_mdio_write(tp, 0x15, 0x00ba);
11199 rtl8168_mdio_write(tp, 0x19, 0x480b);
11200 rtl8168_mdio_write(tp, 0x15, 0x00bb);
11201 rtl8168_mdio_write(tp, 0x19, 0x5e00);
11202 rtl8168_mdio_write(tp, 0x15, 0x00bc);
11203 rtl8168_mdio_write(tp, 0x19, 0x405f);
11204 rtl8168_mdio_write(tp, 0x15, 0x00bd);
11205 rtl8168_mdio_write(tp, 0x19, 0x4448);
11206 rtl8168_mdio_write(tp, 0x15, 0x00be);
11207 rtl8168_mdio_write(tp, 0x19, 0x4020);
11208 rtl8168_mdio_write(tp, 0x15, 0x00bf);
11209 rtl8168_mdio_write(tp, 0x19, 0x4468);
11210 rtl8168_mdio_write(tp, 0x15, 0x00c0);
11211 rtl8168_mdio_write(tp, 0x19, 0x9c02);
11212 rtl8168_mdio_write(tp, 0x15, 0x00c1);
11213 rtl8168_mdio_write(tp, 0x19, 0x58a0);
11214 rtl8168_mdio_write(tp, 0x15, 0x00c2);
11215 rtl8168_mdio_write(tp, 0x19, 0xb605);
11216 rtl8168_mdio_write(tp, 0x15, 0x00c3);
11217 rtl8168_mdio_write(tp, 0x19, 0xc0d3);
11218 rtl8168_mdio_write(tp, 0x15, 0x00c4);
11219 rtl8168_mdio_write(tp, 0x19, 0x00e6);
11220 rtl8168_mdio_write(tp, 0x15, 0x00c5);
11221 rtl8168_mdio_write(tp, 0x19, 0xdaec);
11222 rtl8168_mdio_write(tp, 0x15, 0x00c6);
11223 rtl8168_mdio_write(tp, 0x19, 0x00fa);
11224 rtl8168_mdio_write(tp, 0x15, 0x00c7);
11225 rtl8168_mdio_write(tp, 0x19, 0x9df9);
11226 rtl8168_mdio_write(tp, 0x15, 0x0112);
11227 rtl8168_mdio_write(tp, 0x19, 0x6421);
11228 rtl8168_mdio_write(tp, 0x15, 0x0113);
11229 rtl8168_mdio_write(tp, 0x19, 0x7c08);
11230 rtl8168_mdio_write(tp, 0x15, 0x0114);
11231 rtl8168_mdio_write(tp, 0x19, 0x63f0);
11232 rtl8168_mdio_write(tp, 0x15, 0x0115);
11233 rtl8168_mdio_write(tp, 0x19, 0x4003);
11234 rtl8168_mdio_write(tp, 0x15, 0x0116);
11235 rtl8168_mdio_write(tp, 0x19, 0x4418);
11236 rtl8168_mdio_write(tp, 0x15, 0x0117);
11237 rtl8168_mdio_write(tp, 0x19, 0x9b00);
11238 rtl8168_mdio_write(tp, 0x15, 0x0118);
11239 rtl8168_mdio_write(tp, 0x19, 0x6461);
11240 rtl8168_mdio_write(tp, 0x15, 0x0119);
11241 rtl8168_mdio_write(tp, 0x19, 0x64e1);
11242 rtl8168_mdio_write(tp, 0x15, 0x011a);
11243 rtl8168_mdio_write(tp, 0x19, 0x0000);
11244 rtl8168_mdio_write(tp, 0x15, 0x0150);
11245 rtl8168_mdio_write(tp, 0x19, 0x7c80);
11246 rtl8168_mdio_write(tp, 0x15, 0x0151);
11247 rtl8168_mdio_write(tp, 0x19, 0x6461);
11248 rtl8168_mdio_write(tp, 0x15, 0x0152);
11249 rtl8168_mdio_write(tp, 0x19, 0x4003);
11250 rtl8168_mdio_write(tp, 0x15, 0x0153);
11251 rtl8168_mdio_write(tp, 0x19, 0x4540);
11252 rtl8168_mdio_write(tp, 0x15, 0x0154);
11253 rtl8168_mdio_write(tp, 0x19, 0x9f00);
11254 rtl8168_mdio_write(tp, 0x15, 0x0155);
11255 rtl8168_mdio_write(tp, 0x19, 0x9d00);
11256 rtl8168_mdio_write(tp, 0x15, 0x0156);
11257 rtl8168_mdio_write(tp, 0x19, 0x7c40);
11258 rtl8168_mdio_write(tp, 0x15, 0x0157);
11259 rtl8168_mdio_write(tp, 0x19, 0x6421);
11260 rtl8168_mdio_write(tp, 0x15, 0x0158);
11261 rtl8168_mdio_write(tp, 0x19, 0x7c80);
11262 rtl8168_mdio_write(tp, 0x15, 0x0159);
11263 rtl8168_mdio_write(tp, 0x19, 0x64a1);
11264 rtl8168_mdio_write(tp, 0x15, 0x015a);
11265 rtl8168_mdio_write(tp, 0x19, 0x30fe);
11266 rtl8168_mdio_write(tp, 0x15, 0x029c);
11267 rtl8168_mdio_write(tp, 0x19, 0x0070);
11268 rtl8168_mdio_write(tp, 0x15, 0x02b2);
11269 rtl8168_mdio_write(tp, 0x19, 0x005a);
11270 rtl8168_mdio_write(tp, 0x15, 0x02bd);
11271 rtl8168_mdio_write(tp, 0x19, 0xa522);
11272 rtl8168_mdio_write(tp, 0x15, 0x02ce);
11273 rtl8168_mdio_write(tp, 0x19, 0xb63e);
11274 rtl8168_mdio_write(tp, 0x15, 0x02d9);
11275 rtl8168_mdio_write(tp, 0x19, 0x32df);
11276 rtl8168_mdio_write(tp, 0x15, 0x02df);
11277 rtl8168_mdio_write(tp, 0x19, 0x4500);
11278 rtl8168_mdio_write(tp, 0x15, 0x02e7);
11279 rtl8168_mdio_write(tp, 0x19, 0x0000);
11280 rtl8168_mdio_write(tp, 0x15, 0x02f4);
11281 rtl8168_mdio_write(tp, 0x19, 0xb618);
11282 rtl8168_mdio_write(tp, 0x15, 0x02fb);
11283 rtl8168_mdio_write(tp, 0x19, 0xb900);
11284 rtl8168_mdio_write(tp, 0x15, 0x02fc);
11285 rtl8168_mdio_write(tp, 0x19, 0x49b5);
11286 rtl8168_mdio_write(tp, 0x15, 0x02fd);
11287 rtl8168_mdio_write(tp, 0x19, 0x6812);
11288 rtl8168_mdio_write(tp, 0x15, 0x02fe);
11289 rtl8168_mdio_write(tp, 0x19, 0x66a0);
11290 rtl8168_mdio_write(tp, 0x15, 0x02ff);
11291 rtl8168_mdio_write(tp, 0x19, 0x9900);
11292 rtl8168_mdio_write(tp, 0x15, 0x0300);
11293 rtl8168_mdio_write(tp, 0x19, 0x64a0);
11294 rtl8168_mdio_write(tp, 0x15, 0x0301);
11295 rtl8168_mdio_write(tp, 0x19, 0x3316);
11296 rtl8168_mdio_write(tp, 0x15, 0x0308);
11297 rtl8168_mdio_write(tp, 0x19, 0x0000);
11298 rtl8168_mdio_write(tp, 0x15, 0x030c);
11299 rtl8168_mdio_write(tp, 0x19, 0x3000);
11300 rtl8168_mdio_write(tp, 0x15, 0x0312);
11301 rtl8168_mdio_write(tp, 0x19, 0x0000);
11302 rtl8168_mdio_write(tp, 0x15, 0x0313);
11303 rtl8168_mdio_write(tp, 0x19, 0x0000);
11304 rtl8168_mdio_write(tp, 0x15, 0x0314);
11305 rtl8168_mdio_write(tp, 0x19, 0x0000);
11306 rtl8168_mdio_write(tp, 0x15, 0x0315);
11307 rtl8168_mdio_write(tp, 0x19, 0x0000);
11308 rtl8168_mdio_write(tp, 0x15, 0x0316);
11309 rtl8168_mdio_write(tp, 0x19, 0x49b5);
11310 rtl8168_mdio_write(tp, 0x15, 0x0317);
11311 rtl8168_mdio_write(tp, 0x19, 0x7d00);
11312 rtl8168_mdio_write(tp, 0x15, 0x0318);
11313 rtl8168_mdio_write(tp, 0x19, 0x4d00);
11314 rtl8168_mdio_write(tp, 0x15, 0x0319);
11315 rtl8168_mdio_write(tp, 0x19, 0x6810);
11316 rtl8168_mdio_write(tp, 0x15, 0x031a);
11317 rtl8168_mdio_write(tp, 0x19, 0x6c08);
11318 rtl8168_mdio_write(tp, 0x15, 0x031b);
11319 rtl8168_mdio_write(tp, 0x19, 0x4925);
11320 rtl8168_mdio_write(tp, 0x15, 0x031c);
11321 rtl8168_mdio_write(tp, 0x19, 0x403b);
11322 rtl8168_mdio_write(tp, 0x15, 0x031d);
11323 rtl8168_mdio_write(tp, 0x19, 0xa602);
11324 rtl8168_mdio_write(tp, 0x15, 0x031e);
11325 rtl8168_mdio_write(tp, 0x19, 0x402f);
11326 rtl8168_mdio_write(tp, 0x15, 0x031f);
11327 rtl8168_mdio_write(tp, 0x19, 0x4484);
11328 rtl8168_mdio_write(tp, 0x15, 0x0320);
11329 rtl8168_mdio_write(tp, 0x19, 0x40c8);
11330 rtl8168_mdio_write(tp, 0x15, 0x0321);
11331 rtl8168_mdio_write(tp, 0x19, 0x44c4);
11332 rtl8168_mdio_write(tp, 0x15, 0x0322);
11333 rtl8168_mdio_write(tp, 0x19, 0x404f);
11334 rtl8168_mdio_write(tp, 0x15, 0x0323);
11335 rtl8168_mdio_write(tp, 0x19, 0x44c8);
11336 rtl8168_mdio_write(tp, 0x15, 0x0324);
11337 rtl8168_mdio_write(tp, 0x19, 0xd64f);
11338 rtl8168_mdio_write(tp, 0x15, 0x0325);
11339 rtl8168_mdio_write(tp, 0x19, 0x00e7);
11340 rtl8168_mdio_write(tp, 0x15, 0x0326);
11341 rtl8168_mdio_write(tp, 0x19, 0x7c08);
11342 rtl8168_mdio_write(tp, 0x15, 0x0327);
11343 rtl8168_mdio_write(tp, 0x19, 0x8203);
11344 rtl8168_mdio_write(tp, 0x15, 0x0328);
11345 rtl8168_mdio_write(tp, 0x19, 0x4d48);
11346 rtl8168_mdio_write(tp, 0x15, 0x0329);
11347 rtl8168_mdio_write(tp, 0x19, 0x332b);
11348 rtl8168_mdio_write(tp, 0x15, 0x032a);
11349 rtl8168_mdio_write(tp, 0x19, 0x4d40);
11350 rtl8168_mdio_write(tp, 0x15, 0x032c);
11351 rtl8168_mdio_write(tp, 0x19, 0x00f8);
11352 rtl8168_mdio_write(tp, 0x15, 0x032d);
11353 rtl8168_mdio_write(tp, 0x19, 0x82b2);
11354 rtl8168_mdio_write(tp, 0x15, 0x032f);
11355 rtl8168_mdio_write(tp, 0x19, 0x00b0);
11356 rtl8168_mdio_write(tp, 0x15, 0x0332);
11357 rtl8168_mdio_write(tp, 0x19, 0x91f2);
11358 rtl8168_mdio_write(tp, 0x15, 0x033f);
11359 rtl8168_mdio_write(tp, 0x19, 0xb6cd);
11360 rtl8168_mdio_write(tp, 0x15, 0x0340);
11361 rtl8168_mdio_write(tp, 0x19, 0x9e01);
11362 rtl8168_mdio_write(tp, 0x15, 0x0341);
11363 rtl8168_mdio_write(tp, 0x19, 0xd11d);
11364 rtl8168_mdio_write(tp, 0x15, 0x0342);
11365 rtl8168_mdio_write(tp, 0x19, 0x009d);
11366 rtl8168_mdio_write(tp, 0x15, 0x0343);
11367 rtl8168_mdio_write(tp, 0x19, 0xbb1c);
11368 rtl8168_mdio_write(tp, 0x15, 0x0344);
11369 rtl8168_mdio_write(tp, 0x19, 0x8102);
11370 rtl8168_mdio_write(tp, 0x15, 0x0345);
11371 rtl8168_mdio_write(tp, 0x19, 0x3348);
11372 rtl8168_mdio_write(tp, 0x15, 0x0346);
11373 rtl8168_mdio_write(tp, 0x19, 0xa231);
11374 rtl8168_mdio_write(tp, 0x15, 0x0347);
11375 rtl8168_mdio_write(tp, 0x19, 0x335b);
11376 rtl8168_mdio_write(tp, 0x15, 0x0348);
11377 rtl8168_mdio_write(tp, 0x19, 0x91f7);
11378 rtl8168_mdio_write(tp, 0x15, 0x0349);
11379 rtl8168_mdio_write(tp, 0x19, 0xc218);
11380 rtl8168_mdio_write(tp, 0x15, 0x034a);
11381 rtl8168_mdio_write(tp, 0x19, 0x00f5);
11382 rtl8168_mdio_write(tp, 0x15, 0x034b);
11383 rtl8168_mdio_write(tp, 0x19, 0x335b);
11384 rtl8168_mdio_write(tp, 0x15, 0x034c);
11385 rtl8168_mdio_write(tp, 0x19, 0x0000);
11386 rtl8168_mdio_write(tp, 0x15, 0x034d);
11387 rtl8168_mdio_write(tp, 0x19, 0x0000);
11388 rtl8168_mdio_write(tp, 0x15, 0x034e);
11389 rtl8168_mdio_write(tp, 0x19, 0x0000);
11390 rtl8168_mdio_write(tp, 0x15, 0x034f);
11391 rtl8168_mdio_write(tp, 0x19, 0x0000);
11392 rtl8168_mdio_write(tp, 0x15, 0x0350);
11393 rtl8168_mdio_write(tp, 0x19, 0x0000);
11394 rtl8168_mdio_write(tp, 0x15, 0x035b);
11395 rtl8168_mdio_write(tp, 0x19, 0xa23c);
11396 rtl8168_mdio_write(tp, 0x15, 0x035c);
11397 rtl8168_mdio_write(tp, 0x19, 0x7c08);
11398 rtl8168_mdio_write(tp, 0x15, 0x035d);
11399 rtl8168_mdio_write(tp, 0x19, 0x4c00);
11400 rtl8168_mdio_write(tp, 0x15, 0x035e);
11401 rtl8168_mdio_write(tp, 0x19, 0x3397);
11402 rtl8168_mdio_write(tp, 0x15, 0x0363);
11403 rtl8168_mdio_write(tp, 0x19, 0xb6a9);
11404 rtl8168_mdio_write(tp, 0x15, 0x0366);
11405 rtl8168_mdio_write(tp, 0x19, 0x00f5);
11406 rtl8168_mdio_write(tp, 0x15, 0x0382);
11407 rtl8168_mdio_write(tp, 0x19, 0x7c40);
11408 rtl8168_mdio_write(tp, 0x15, 0x0388);
11409 rtl8168_mdio_write(tp, 0x19, 0x0084);
11410 rtl8168_mdio_write(tp, 0x15, 0x0389);
11411 rtl8168_mdio_write(tp, 0x19, 0xdd17);
11412 rtl8168_mdio_write(tp, 0x15, 0x038a);
11413 rtl8168_mdio_write(tp, 0x19, 0x000b);
11414 rtl8168_mdio_write(tp, 0x15, 0x038b);
11415 rtl8168_mdio_write(tp, 0x19, 0xa10a);
11416 rtl8168_mdio_write(tp, 0x15, 0x038c);
11417 rtl8168_mdio_write(tp, 0x19, 0x337e);
11418 rtl8168_mdio_write(tp, 0x15, 0x038d);
11419 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
11420 rtl8168_mdio_write(tp, 0x15, 0x038e);
11421 rtl8168_mdio_write(tp, 0x19, 0xa107);
11422 rtl8168_mdio_write(tp, 0x15, 0x038f);
11423 rtl8168_mdio_write(tp, 0x19, 0x6c08);
11424 rtl8168_mdio_write(tp, 0x15, 0x0390);
11425 rtl8168_mdio_write(tp, 0x19, 0xc017);
11426 rtl8168_mdio_write(tp, 0x15, 0x0391);
11427 rtl8168_mdio_write(tp, 0x19, 0x0004);
11428 rtl8168_mdio_write(tp, 0x15, 0x0392);
11429 rtl8168_mdio_write(tp, 0x19, 0xd64f);
11430 rtl8168_mdio_write(tp, 0x15, 0x0393);
11431 rtl8168_mdio_write(tp, 0x19, 0x00f4);
11432 rtl8168_mdio_write(tp, 0x15, 0x0397);
11433 rtl8168_mdio_write(tp, 0x19, 0x4098);
11434 rtl8168_mdio_write(tp, 0x15, 0x0398);
11435 rtl8168_mdio_write(tp, 0x19, 0x4408);
11436 rtl8168_mdio_write(tp, 0x15, 0x0399);
11437 rtl8168_mdio_write(tp, 0x19, 0x55bf);
11438 rtl8168_mdio_write(tp, 0x15, 0x039a);
11439 rtl8168_mdio_write(tp, 0x19, 0x4bb9);
11440 rtl8168_mdio_write(tp, 0x15, 0x039b);
11441 rtl8168_mdio_write(tp, 0x19, 0x6810);
11442 rtl8168_mdio_write(tp, 0x15, 0x039c);
11443 rtl8168_mdio_write(tp, 0x19, 0x4b29);
11444 rtl8168_mdio_write(tp, 0x15, 0x039d);
11445 rtl8168_mdio_write(tp, 0x19, 0x4041);
11446 rtl8168_mdio_write(tp, 0x15, 0x039e);
11447 rtl8168_mdio_write(tp, 0x19, 0x442a);
11448 rtl8168_mdio_write(tp, 0x15, 0x039f);
11449 rtl8168_mdio_write(tp, 0x19, 0x4029);
11450 rtl8168_mdio_write(tp, 0x15, 0x03aa);
11451 rtl8168_mdio_write(tp, 0x19, 0x33b8);
11452 rtl8168_mdio_write(tp, 0x15, 0x03b6);
11453 rtl8168_mdio_write(tp, 0x19, 0x0000);
11454 rtl8168_mdio_write(tp, 0x15, 0x03b7);
11455 rtl8168_mdio_write(tp, 0x19, 0x0000);
11456 rtl8168_mdio_write(tp, 0x15, 0x03b8);
11457 rtl8168_mdio_write(tp, 0x19, 0x543f);
11458 rtl8168_mdio_write(tp, 0x15, 0x03b9);
11459 rtl8168_mdio_write(tp, 0x19, 0x499a);
11460 rtl8168_mdio_write(tp, 0x15, 0x03ba);
11461 rtl8168_mdio_write(tp, 0x19, 0x7c40);
11462 rtl8168_mdio_write(tp, 0x15, 0x03bb);
11463 rtl8168_mdio_write(tp, 0x19, 0x4c40);
11464 rtl8168_mdio_write(tp, 0x15, 0x03bc);
11465 rtl8168_mdio_write(tp, 0x19, 0x490a);
11466 rtl8168_mdio_write(tp, 0x15, 0x03bd);
11467 rtl8168_mdio_write(tp, 0x19, 0x405e);
11468 rtl8168_mdio_write(tp, 0x15, 0x03c2);
11469 rtl8168_mdio_write(tp, 0x19, 0x9a03);
11470 rtl8168_mdio_write(tp, 0x15, 0x03c4);
11471 rtl8168_mdio_write(tp, 0x19, 0x0015);
11472 rtl8168_mdio_write(tp, 0x15, 0x03c5);
11473 rtl8168_mdio_write(tp, 0x19, 0x9e03);
11474 rtl8168_mdio_write(tp, 0x15, 0x03c8);
11475 rtl8168_mdio_write(tp, 0x19, 0x9cf7);
11476 rtl8168_mdio_write(tp, 0x15, 0x03c9);
11477 rtl8168_mdio_write(tp, 0x19, 0x7c12);
11478 rtl8168_mdio_write(tp, 0x15, 0x03ca);
11479 rtl8168_mdio_write(tp, 0x19, 0x4c52);
11480 rtl8168_mdio_write(tp, 0x15, 0x03cb);
11481 rtl8168_mdio_write(tp, 0x19, 0x4458);
11482 rtl8168_mdio_write(tp, 0x15, 0x03cd);
11483 rtl8168_mdio_write(tp, 0x19, 0x4c40);
11484 rtl8168_mdio_write(tp, 0x15, 0x03ce);
11485 rtl8168_mdio_write(tp, 0x19, 0x33bf);
11486 rtl8168_mdio_write(tp, 0x15, 0x03cf);
11487 rtl8168_mdio_write(tp, 0x19, 0x0000);
11488 rtl8168_mdio_write(tp, 0x15, 0x03d0);
11489 rtl8168_mdio_write(tp, 0x19, 0x0000);
11490 rtl8168_mdio_write(tp, 0x15, 0x03d1);
11491 rtl8168_mdio_write(tp, 0x19, 0x0000);
11492 rtl8168_mdio_write(tp, 0x15, 0x03d5);
11493 rtl8168_mdio_write(tp, 0x19, 0x0000);
11494 rtl8168_mdio_write(tp, 0x15, 0x03d6);
11495 rtl8168_mdio_write(tp, 0x19, 0x0000);
11496 rtl8168_mdio_write(tp, 0x15, 0x03d7);
11497 rtl8168_mdio_write(tp, 0x19, 0x0000);
11498 rtl8168_mdio_write(tp, 0x15, 0x03d8);
11499 rtl8168_mdio_write(tp, 0x19, 0x0000);
11500 rtl8168_mdio_write(tp, 0x15, 0x03d9);
11501 rtl8168_mdio_write(tp, 0x19, 0x49bb);
11502 rtl8168_mdio_write(tp, 0x15, 0x03da);
11503 rtl8168_mdio_write(tp, 0x19, 0x4478);
11504 rtl8168_mdio_write(tp, 0x15, 0x03db);
11505 rtl8168_mdio_write(tp, 0x19, 0x492b);
11506 rtl8168_mdio_write(tp, 0x15, 0x03dc);
11507 rtl8168_mdio_write(tp, 0x19, 0x7c01);
11508 rtl8168_mdio_write(tp, 0x15, 0x03dd);
11509 rtl8168_mdio_write(tp, 0x19, 0x4c00);
11510 rtl8168_mdio_write(tp, 0x15, 0x03de);
11511 rtl8168_mdio_write(tp, 0x19, 0xbd1a);
11512 rtl8168_mdio_write(tp, 0x15, 0x03df);
11513 rtl8168_mdio_write(tp, 0x19, 0xc428);
11514 rtl8168_mdio_write(tp, 0x15, 0x03e0);
11515 rtl8168_mdio_write(tp, 0x19, 0x0008);
11516 rtl8168_mdio_write(tp, 0x15, 0x03e1);
11517 rtl8168_mdio_write(tp, 0x19, 0x9cfd);
11518 rtl8168_mdio_write(tp, 0x15, 0x03e2);
11519 rtl8168_mdio_write(tp, 0x19, 0x7c12);
11520 rtl8168_mdio_write(tp, 0x15, 0x03e3);
11521 rtl8168_mdio_write(tp, 0x19, 0x4c52);
11522 rtl8168_mdio_write(tp, 0x15, 0x03e4);
11523 rtl8168_mdio_write(tp, 0x19, 0x4458);
11524 rtl8168_mdio_write(tp, 0x15, 0x03e5);
11525 rtl8168_mdio_write(tp, 0x19, 0x7c12);
11526 rtl8168_mdio_write(tp, 0x15, 0x03e6);
11527 rtl8168_mdio_write(tp, 0x19, 0x4c40);
11528 rtl8168_mdio_write(tp, 0x15, 0x03e7);
11529 rtl8168_mdio_write(tp, 0x19, 0x33de);
11530 rtl8168_mdio_write(tp, 0x15, 0x03e8);
11531 rtl8168_mdio_write(tp, 0x19, 0xc218);
11532 rtl8168_mdio_write(tp, 0x15, 0x03e9);
11533 rtl8168_mdio_write(tp, 0x19, 0x0002);
11534 rtl8168_mdio_write(tp, 0x15, 0x03ea);
11535 rtl8168_mdio_write(tp, 0x19, 0x32df);
11536 rtl8168_mdio_write(tp, 0x15, 0x03eb);
11537 rtl8168_mdio_write(tp, 0x19, 0x3316);
11538 rtl8168_mdio_write(tp, 0x15, 0x03ec);
11539 rtl8168_mdio_write(tp, 0x19, 0x0000);
11540 rtl8168_mdio_write(tp, 0x15, 0x03ed);
11541 rtl8168_mdio_write(tp, 0x19, 0x0000);
11542 rtl8168_mdio_write(tp, 0x15, 0x03ee);
11543 rtl8168_mdio_write(tp, 0x19, 0x0000);
11544 rtl8168_mdio_write(tp, 0x15, 0x03ef);
11545 rtl8168_mdio_write(tp, 0x19, 0x0000);
11546 rtl8168_mdio_write(tp, 0x15, 0x03f7);
11547 rtl8168_mdio_write(tp, 0x19, 0x330c);
11548 rtl8168_mdio_write(tp, 0x16, 0x0306);
11549 rtl8168_mdio_write(tp, 0x16, 0x0300);
11550
11551 rtl8168_mdio_write(tp, 0x1f, 0x0005);
11552 rtl8168_mdio_write(tp, 0x05, 0xfff6);
11553 rtl8168_mdio_write(tp, 0x06, 0x0080);
11554 rtl8168_mdio_write(tp, 0x05, 0x8000);
11555 rtl8168_mdio_write(tp, 0x06, 0x0280);
11556 rtl8168_mdio_write(tp, 0x06, 0x48f7);
11557 rtl8168_mdio_write(tp, 0x06, 0x00e0);
11558 rtl8168_mdio_write(tp, 0x06, 0xfff7);
11559 rtl8168_mdio_write(tp, 0x06, 0xa080);
11560 rtl8168_mdio_write(tp, 0x06, 0x02ae);
11561 rtl8168_mdio_write(tp, 0x06, 0xf602);
11562 rtl8168_mdio_write(tp, 0x06, 0x0200);
11563 rtl8168_mdio_write(tp, 0x06, 0x0280);
11564 rtl8168_mdio_write(tp, 0x06, 0x9002);
11565 rtl8168_mdio_write(tp, 0x06, 0x0224);
11566 rtl8168_mdio_write(tp, 0x06, 0x0202);
11567 rtl8168_mdio_write(tp, 0x06, 0x3402);
11568 rtl8168_mdio_write(tp, 0x06, 0x027f);
11569 rtl8168_mdio_write(tp, 0x06, 0x0280);
11570 rtl8168_mdio_write(tp, 0x06, 0xa602);
11571 rtl8168_mdio_write(tp, 0x06, 0x80bf);
11572 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11573 rtl8168_mdio_write(tp, 0x06, 0x88e1);
11574 rtl8168_mdio_write(tp, 0x06, 0x8b89);
11575 rtl8168_mdio_write(tp, 0x06, 0x1e01);
11576 rtl8168_mdio_write(tp, 0x06, 0xe18b);
11577 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
11578 rtl8168_mdio_write(tp, 0x06, 0x01e1);
11579 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
11580 rtl8168_mdio_write(tp, 0x06, 0x1e01);
11581 rtl8168_mdio_write(tp, 0x06, 0xe18b);
11582 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
11583 rtl8168_mdio_write(tp, 0x06, 0x01e1);
11584 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
11585 rtl8168_mdio_write(tp, 0x06, 0x1e01);
11586 rtl8168_mdio_write(tp, 0x06, 0xe18b);
11587 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
11588 rtl8168_mdio_write(tp, 0x06, 0x01a0);
11589 rtl8168_mdio_write(tp, 0x06, 0x00c7);
11590 rtl8168_mdio_write(tp, 0x06, 0xaebb);
11591 rtl8168_mdio_write(tp, 0x06, 0xee8a);
11592 rtl8168_mdio_write(tp, 0x06, 0xe600);
11593 rtl8168_mdio_write(tp, 0x06, 0xee8a);
11594 rtl8168_mdio_write(tp, 0x06, 0xee03);
11595 rtl8168_mdio_write(tp, 0x06, 0xee8a);
11596 rtl8168_mdio_write(tp, 0x06, 0xefb8);
11597 rtl8168_mdio_write(tp, 0x06, 0xee8a);
11598 rtl8168_mdio_write(tp, 0x06, 0xe902);
11599 rtl8168_mdio_write(tp, 0x06, 0xee8b);
11600 rtl8168_mdio_write(tp, 0x06, 0x8285);
11601 rtl8168_mdio_write(tp, 0x06, 0xee8b);
11602 rtl8168_mdio_write(tp, 0x06, 0x8520);
11603 rtl8168_mdio_write(tp, 0x06, 0xee8b);
11604 rtl8168_mdio_write(tp, 0x06, 0x8701);
11605 rtl8168_mdio_write(tp, 0x06, 0xd481);
11606 rtl8168_mdio_write(tp, 0x06, 0x35e4);
11607 rtl8168_mdio_write(tp, 0x06, 0x8b94);
11608 rtl8168_mdio_write(tp, 0x06, 0xe58b);
11609 rtl8168_mdio_write(tp, 0x06, 0x95bf);
11610 rtl8168_mdio_write(tp, 0x06, 0x8b88);
11611 rtl8168_mdio_write(tp, 0x06, 0xec00);
11612 rtl8168_mdio_write(tp, 0x06, 0x19a9);
11613 rtl8168_mdio_write(tp, 0x06, 0x8b90);
11614 rtl8168_mdio_write(tp, 0x06, 0xf9ee);
11615 rtl8168_mdio_write(tp, 0x06, 0xfff6);
11616 rtl8168_mdio_write(tp, 0x06, 0x00ee);
11617 rtl8168_mdio_write(tp, 0x06, 0xfff7);
11618 rtl8168_mdio_write(tp, 0x06, 0xffe0);
11619 rtl8168_mdio_write(tp, 0x06, 0xe140);
11620 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
11621 rtl8168_mdio_write(tp, 0x06, 0x41f7);
11622 rtl8168_mdio_write(tp, 0x06, 0x2ff6);
11623 rtl8168_mdio_write(tp, 0x06, 0x28e4);
11624 rtl8168_mdio_write(tp, 0x06, 0xe140);
11625 rtl8168_mdio_write(tp, 0x06, 0xe5e1);
11626 rtl8168_mdio_write(tp, 0x06, 0x4104);
11627 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
11628 rtl8168_mdio_write(tp, 0x06, 0x8b89);
11629 rtl8168_mdio_write(tp, 0x06, 0xad20);
11630 rtl8168_mdio_write(tp, 0x06, 0x0dee);
11631 rtl8168_mdio_write(tp, 0x06, 0x8b89);
11632 rtl8168_mdio_write(tp, 0x06, 0x0002);
11633 rtl8168_mdio_write(tp, 0x06, 0x82f4);
11634 rtl8168_mdio_write(tp, 0x06, 0x021f);
11635 rtl8168_mdio_write(tp, 0x06, 0x4102);
11636 rtl8168_mdio_write(tp, 0x06, 0x2812);
11637 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11638 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
11639 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
11640 rtl8168_mdio_write(tp, 0x06, 0xad20);
11641 rtl8168_mdio_write(tp, 0x06, 0x10ee);
11642 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
11643 rtl8168_mdio_write(tp, 0x06, 0x0002);
11644 rtl8168_mdio_write(tp, 0x06, 0x139d);
11645 rtl8168_mdio_write(tp, 0x06, 0x0281);
11646 rtl8168_mdio_write(tp, 0x06, 0xd602);
11647 rtl8168_mdio_write(tp, 0x06, 0x1f99);
11648 rtl8168_mdio_write(tp, 0x06, 0x0227);
11649 rtl8168_mdio_write(tp, 0x06, 0xeafc);
11650 rtl8168_mdio_write(tp, 0x06, 0x04f8);
11651 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11652 rtl8168_mdio_write(tp, 0x06, 0x8ead);
11653 rtl8168_mdio_write(tp, 0x06, 0x2014);
11654 rtl8168_mdio_write(tp, 0x06, 0xf620);
11655 rtl8168_mdio_write(tp, 0x06, 0xe48b);
11656 rtl8168_mdio_write(tp, 0x06, 0x8e02);
11657 rtl8168_mdio_write(tp, 0x06, 0x8104);
11658 rtl8168_mdio_write(tp, 0x06, 0x021b);
11659 rtl8168_mdio_write(tp, 0x06, 0xf402);
11660 rtl8168_mdio_write(tp, 0x06, 0x2c9c);
11661 rtl8168_mdio_write(tp, 0x06, 0x0281);
11662 rtl8168_mdio_write(tp, 0x06, 0x7902);
11663 rtl8168_mdio_write(tp, 0x06, 0x8443);
11664 rtl8168_mdio_write(tp, 0x06, 0xad22);
11665 rtl8168_mdio_write(tp, 0x06, 0x11f6);
11666 rtl8168_mdio_write(tp, 0x06, 0x22e4);
11667 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
11668 rtl8168_mdio_write(tp, 0x06, 0x022c);
11669 rtl8168_mdio_write(tp, 0x06, 0x4602);
11670 rtl8168_mdio_write(tp, 0x06, 0x2ac5);
11671 rtl8168_mdio_write(tp, 0x06, 0x0229);
11672 rtl8168_mdio_write(tp, 0x06, 0x2002);
11673 rtl8168_mdio_write(tp, 0x06, 0x2b91);
11674 rtl8168_mdio_write(tp, 0x06, 0xad25);
11675 rtl8168_mdio_write(tp, 0x06, 0x11f6);
11676 rtl8168_mdio_write(tp, 0x06, 0x25e4);
11677 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
11678 rtl8168_mdio_write(tp, 0x06, 0x0284);
11679 rtl8168_mdio_write(tp, 0x06, 0xe202);
11680 rtl8168_mdio_write(tp, 0x06, 0x043a);
11681 rtl8168_mdio_write(tp, 0x06, 0x021a);
11682 rtl8168_mdio_write(tp, 0x06, 0x5902);
11683 rtl8168_mdio_write(tp, 0x06, 0x2bfc);
11684 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11685 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
11686 rtl8168_mdio_write(tp, 0x06, 0xef69);
11687 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
11688 rtl8168_mdio_write(tp, 0x06, 0x00e1);
11689 rtl8168_mdio_write(tp, 0x06, 0xe001);
11690 rtl8168_mdio_write(tp, 0x06, 0xad27);
11691 rtl8168_mdio_write(tp, 0x06, 0x1fd1);
11692 rtl8168_mdio_write(tp, 0x06, 0x01bf);
11693 rtl8168_mdio_write(tp, 0x06, 0x8638);
11694 rtl8168_mdio_write(tp, 0x06, 0x022f);
11695 rtl8168_mdio_write(tp, 0x06, 0x50e0);
11696 rtl8168_mdio_write(tp, 0x06, 0xe020);
11697 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
11698 rtl8168_mdio_write(tp, 0x06, 0x21ad);
11699 rtl8168_mdio_write(tp, 0x06, 0x200e);
11700 rtl8168_mdio_write(tp, 0x06, 0xd100);
11701 rtl8168_mdio_write(tp, 0x06, 0xbf86);
11702 rtl8168_mdio_write(tp, 0x06, 0x3802);
11703 rtl8168_mdio_write(tp, 0x06, 0x2f50);
11704 rtl8168_mdio_write(tp, 0x06, 0xbf3d);
11705 rtl8168_mdio_write(tp, 0x06, 0x3902);
11706 rtl8168_mdio_write(tp, 0x06, 0x2eb0);
11707 rtl8168_mdio_write(tp, 0x06, 0xef96);
11708 rtl8168_mdio_write(tp, 0x06, 0xfefc);
11709 rtl8168_mdio_write(tp, 0x06, 0x0402);
11710 rtl8168_mdio_write(tp, 0x06, 0x8591);
11711 rtl8168_mdio_write(tp, 0x06, 0x0281);
11712 rtl8168_mdio_write(tp, 0x06, 0x3c05);
11713 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
11714 rtl8168_mdio_write(tp, 0x06, 0xef69);
11715 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
11716 rtl8168_mdio_write(tp, 0x06, 0xfee1);
11717 rtl8168_mdio_write(tp, 0x06, 0xe2ff);
11718 rtl8168_mdio_write(tp, 0x06, 0xad2d);
11719 rtl8168_mdio_write(tp, 0x06, 0x1ae0);
11720 rtl8168_mdio_write(tp, 0x06, 0xe14e);
11721 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
11722 rtl8168_mdio_write(tp, 0x06, 0x4fac);
11723 rtl8168_mdio_write(tp, 0x06, 0x2d22);
11724 rtl8168_mdio_write(tp, 0x06, 0xf603);
11725 rtl8168_mdio_write(tp, 0x06, 0x0203);
11726 rtl8168_mdio_write(tp, 0x06, 0x36f7);
11727 rtl8168_mdio_write(tp, 0x06, 0x03f7);
11728 rtl8168_mdio_write(tp, 0x06, 0x06bf);
11729 rtl8168_mdio_write(tp, 0x06, 0x8622);
11730 rtl8168_mdio_write(tp, 0x06, 0x022e);
11731 rtl8168_mdio_write(tp, 0x06, 0xb0ae);
11732 rtl8168_mdio_write(tp, 0x06, 0x11e0);
11733 rtl8168_mdio_write(tp, 0x06, 0xe14e);
11734 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
11735 rtl8168_mdio_write(tp, 0x06, 0x4fad);
11736 rtl8168_mdio_write(tp, 0x06, 0x2d08);
11737 rtl8168_mdio_write(tp, 0x06, 0xbf86);
11738 rtl8168_mdio_write(tp, 0x06, 0x2d02);
11739 rtl8168_mdio_write(tp, 0x06, 0x2eb0);
11740 rtl8168_mdio_write(tp, 0x06, 0xf606);
11741 rtl8168_mdio_write(tp, 0x06, 0xef96);
11742 rtl8168_mdio_write(tp, 0x06, 0xfefc);
11743 rtl8168_mdio_write(tp, 0x06, 0x04f8);
11744 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
11745 rtl8168_mdio_write(tp, 0x06, 0xef69);
11746 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11747 rtl8168_mdio_write(tp, 0x06, 0x87ad);
11748 rtl8168_mdio_write(tp, 0x06, 0x204c);
11749 rtl8168_mdio_write(tp, 0x06, 0xd200);
11750 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
11751 rtl8168_mdio_write(tp, 0x06, 0x0058);
11752 rtl8168_mdio_write(tp, 0x06, 0x010c);
11753 rtl8168_mdio_write(tp, 0x06, 0x021e);
11754 rtl8168_mdio_write(tp, 0x06, 0x20e0);
11755 rtl8168_mdio_write(tp, 0x06, 0xe000);
11756 rtl8168_mdio_write(tp, 0x06, 0x5810);
11757 rtl8168_mdio_write(tp, 0x06, 0x1e20);
11758 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
11759 rtl8168_mdio_write(tp, 0x06, 0x3658);
11760 rtl8168_mdio_write(tp, 0x06, 0x031e);
11761 rtl8168_mdio_write(tp, 0x06, 0x20e0);
11762 rtl8168_mdio_write(tp, 0x06, 0xe022);
11763 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
11764 rtl8168_mdio_write(tp, 0x06, 0x2358);
11765 rtl8168_mdio_write(tp, 0x06, 0xe01e);
11766 rtl8168_mdio_write(tp, 0x06, 0x20e0);
11767 rtl8168_mdio_write(tp, 0x06, 0x8ae6);
11768 rtl8168_mdio_write(tp, 0x06, 0x1f02);
11769 rtl8168_mdio_write(tp, 0x06, 0x9e22);
11770 rtl8168_mdio_write(tp, 0x06, 0xe68a);
11771 rtl8168_mdio_write(tp, 0x06, 0xe6ad);
11772 rtl8168_mdio_write(tp, 0x06, 0x3214);
11773 rtl8168_mdio_write(tp, 0x06, 0xad34);
11774 rtl8168_mdio_write(tp, 0x06, 0x11ef);
11775 rtl8168_mdio_write(tp, 0x06, 0x0258);
11776 rtl8168_mdio_write(tp, 0x06, 0x039e);
11777 rtl8168_mdio_write(tp, 0x06, 0x07ad);
11778 rtl8168_mdio_write(tp, 0x06, 0x3508);
11779 rtl8168_mdio_write(tp, 0x06, 0x5ac0);
11780 rtl8168_mdio_write(tp, 0x06, 0x9f04);
11781 rtl8168_mdio_write(tp, 0x06, 0xd101);
11782 rtl8168_mdio_write(tp, 0x06, 0xae02);
11783 rtl8168_mdio_write(tp, 0x06, 0xd100);
11784 rtl8168_mdio_write(tp, 0x06, 0xbf86);
11785 rtl8168_mdio_write(tp, 0x06, 0x3e02);
11786 rtl8168_mdio_write(tp, 0x06, 0x2f50);
11787 rtl8168_mdio_write(tp, 0x06, 0xef96);
11788 rtl8168_mdio_write(tp, 0x06, 0xfefd);
11789 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11790 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
11791 rtl8168_mdio_write(tp, 0x06, 0xfae0);
11792 rtl8168_mdio_write(tp, 0x06, 0x8b81);
11793 rtl8168_mdio_write(tp, 0x06, 0xac26);
11794 rtl8168_mdio_write(tp, 0x06, 0x0ee0);
11795 rtl8168_mdio_write(tp, 0x06, 0x8b81);
11796 rtl8168_mdio_write(tp, 0x06, 0xac21);
11797 rtl8168_mdio_write(tp, 0x06, 0x08e0);
11798 rtl8168_mdio_write(tp, 0x06, 0x8b87);
11799 rtl8168_mdio_write(tp, 0x06, 0xac24);
11800 rtl8168_mdio_write(tp, 0x06, 0x02ae);
11801 rtl8168_mdio_write(tp, 0x06, 0x6bee);
11802 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
11803 rtl8168_mdio_write(tp, 0x06, 0x00ee);
11804 rtl8168_mdio_write(tp, 0x06, 0xe0eb);
11805 rtl8168_mdio_write(tp, 0x06, 0x00e2);
11806 rtl8168_mdio_write(tp, 0x06, 0xe07c);
11807 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
11808 rtl8168_mdio_write(tp, 0x06, 0x7da5);
11809 rtl8168_mdio_write(tp, 0x06, 0x1111);
11810 rtl8168_mdio_write(tp, 0x06, 0x15d2);
11811 rtl8168_mdio_write(tp, 0x06, 0x60d6);
11812 rtl8168_mdio_write(tp, 0x06, 0x6666);
11813 rtl8168_mdio_write(tp, 0x06, 0x0207);
11814 rtl8168_mdio_write(tp, 0x06, 0xf9d2);
11815 rtl8168_mdio_write(tp, 0x06, 0xa0d6);
11816 rtl8168_mdio_write(tp, 0x06, 0xaaaa);
11817 rtl8168_mdio_write(tp, 0x06, 0x0207);
11818 rtl8168_mdio_write(tp, 0x06, 0xf902);
11819 rtl8168_mdio_write(tp, 0x06, 0x825c);
11820 rtl8168_mdio_write(tp, 0x06, 0xae44);
11821 rtl8168_mdio_write(tp, 0x06, 0xa566);
11822 rtl8168_mdio_write(tp, 0x06, 0x6602);
11823 rtl8168_mdio_write(tp, 0x06, 0xae38);
11824 rtl8168_mdio_write(tp, 0x06, 0xa5aa);
11825 rtl8168_mdio_write(tp, 0x06, 0xaa02);
11826 rtl8168_mdio_write(tp, 0x06, 0xae32);
11827 rtl8168_mdio_write(tp, 0x06, 0xeee0);
11828 rtl8168_mdio_write(tp, 0x06, 0xea04);
11829 rtl8168_mdio_write(tp, 0x06, 0xeee0);
11830 rtl8168_mdio_write(tp, 0x06, 0xeb06);
11831 rtl8168_mdio_write(tp, 0x06, 0xe2e0);
11832 rtl8168_mdio_write(tp, 0x06, 0x7ce3);
11833 rtl8168_mdio_write(tp, 0x06, 0xe07d);
11834 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
11835 rtl8168_mdio_write(tp, 0x06, 0x38e1);
11836 rtl8168_mdio_write(tp, 0x06, 0xe039);
11837 rtl8168_mdio_write(tp, 0x06, 0xad2e);
11838 rtl8168_mdio_write(tp, 0x06, 0x21ad);
11839 rtl8168_mdio_write(tp, 0x06, 0x3f13);
11840 rtl8168_mdio_write(tp, 0x06, 0xe0e4);
11841 rtl8168_mdio_write(tp, 0x06, 0x14e1);
11842 rtl8168_mdio_write(tp, 0x06, 0xe415);
11843 rtl8168_mdio_write(tp, 0x06, 0x6880);
11844 rtl8168_mdio_write(tp, 0x06, 0xe4e4);
11845 rtl8168_mdio_write(tp, 0x06, 0x14e5);
11846 rtl8168_mdio_write(tp, 0x06, 0xe415);
11847 rtl8168_mdio_write(tp, 0x06, 0x0282);
11848 rtl8168_mdio_write(tp, 0x06, 0x5cae);
11849 rtl8168_mdio_write(tp, 0x06, 0x0bac);
11850 rtl8168_mdio_write(tp, 0x06, 0x3e02);
11851 rtl8168_mdio_write(tp, 0x06, 0xae06);
11852 rtl8168_mdio_write(tp, 0x06, 0x0282);
11853 rtl8168_mdio_write(tp, 0x06, 0x8602);
11854 rtl8168_mdio_write(tp, 0x06, 0x82b0);
11855 rtl8168_mdio_write(tp, 0x06, 0xfefd);
11856 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11857 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
11858 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
11859 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11860 rtl8168_mdio_write(tp, 0x06, 0x81ad);
11861 rtl8168_mdio_write(tp, 0x06, 0x2605);
11862 rtl8168_mdio_write(tp, 0x06, 0x0221);
11863 rtl8168_mdio_write(tp, 0x06, 0xf3f7);
11864 rtl8168_mdio_write(tp, 0x06, 0x28e0);
11865 rtl8168_mdio_write(tp, 0x06, 0x8b81);
11866 rtl8168_mdio_write(tp, 0x06, 0xad21);
11867 rtl8168_mdio_write(tp, 0x06, 0x0502);
11868 rtl8168_mdio_write(tp, 0x06, 0x22f8);
11869 rtl8168_mdio_write(tp, 0x06, 0xf729);
11870 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11871 rtl8168_mdio_write(tp, 0x06, 0x87ad);
11872 rtl8168_mdio_write(tp, 0x06, 0x2405);
11873 rtl8168_mdio_write(tp, 0x06, 0x0282);
11874 rtl8168_mdio_write(tp, 0x06, 0xebf7);
11875 rtl8168_mdio_write(tp, 0x06, 0x2ae5);
11876 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
11877 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11878 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
11879 rtl8168_mdio_write(tp, 0x06, 0x8b81);
11880 rtl8168_mdio_write(tp, 0x06, 0xad26);
11881 rtl8168_mdio_write(tp, 0x06, 0x0302);
11882 rtl8168_mdio_write(tp, 0x06, 0x2134);
11883 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11884 rtl8168_mdio_write(tp, 0x06, 0x81ad);
11885 rtl8168_mdio_write(tp, 0x06, 0x2109);
11886 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11887 rtl8168_mdio_write(tp, 0x06, 0x2eac);
11888 rtl8168_mdio_write(tp, 0x06, 0x2003);
11889 rtl8168_mdio_write(tp, 0x06, 0x0283);
11890 rtl8168_mdio_write(tp, 0x06, 0x52e0);
11891 rtl8168_mdio_write(tp, 0x06, 0x8b87);
11892 rtl8168_mdio_write(tp, 0x06, 0xad24);
11893 rtl8168_mdio_write(tp, 0x06, 0x09e0);
11894 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
11895 rtl8168_mdio_write(tp, 0x06, 0xac21);
11896 rtl8168_mdio_write(tp, 0x06, 0x0302);
11897 rtl8168_mdio_write(tp, 0x06, 0x8337);
11898 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11899 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
11900 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
11901 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11902 rtl8168_mdio_write(tp, 0x06, 0x81ad);
11903 rtl8168_mdio_write(tp, 0x06, 0x2608);
11904 rtl8168_mdio_write(tp, 0x06, 0xe085);
11905 rtl8168_mdio_write(tp, 0x06, 0xd2ad);
11906 rtl8168_mdio_write(tp, 0x06, 0x2502);
11907 rtl8168_mdio_write(tp, 0x06, 0xf628);
11908 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11909 rtl8168_mdio_write(tp, 0x06, 0x81ad);
11910 rtl8168_mdio_write(tp, 0x06, 0x210a);
11911 rtl8168_mdio_write(tp, 0x06, 0xe086);
11912 rtl8168_mdio_write(tp, 0x06, 0x0af6);
11913 rtl8168_mdio_write(tp, 0x06, 0x27a0);
11914 rtl8168_mdio_write(tp, 0x06, 0x0502);
11915 rtl8168_mdio_write(tp, 0x06, 0xf629);
11916 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11917 rtl8168_mdio_write(tp, 0x06, 0x87ad);
11918 rtl8168_mdio_write(tp, 0x06, 0x2408);
11919 rtl8168_mdio_write(tp, 0x06, 0xe08a);
11920 rtl8168_mdio_write(tp, 0x06, 0xedad);
11921 rtl8168_mdio_write(tp, 0x06, 0x2002);
11922 rtl8168_mdio_write(tp, 0x06, 0xf62a);
11923 rtl8168_mdio_write(tp, 0x06, 0xe58b);
11924 rtl8168_mdio_write(tp, 0x06, 0x2ea1);
11925 rtl8168_mdio_write(tp, 0x06, 0x0003);
11926 rtl8168_mdio_write(tp, 0x06, 0x0221);
11927 rtl8168_mdio_write(tp, 0x06, 0x11fc);
11928 rtl8168_mdio_write(tp, 0x06, 0x04ee);
11929 rtl8168_mdio_write(tp, 0x06, 0x8aed);
11930 rtl8168_mdio_write(tp, 0x06, 0x00ee);
11931 rtl8168_mdio_write(tp, 0x06, 0x8aec);
11932 rtl8168_mdio_write(tp, 0x06, 0x0004);
11933 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
11934 rtl8168_mdio_write(tp, 0x06, 0x8b87);
11935 rtl8168_mdio_write(tp, 0x06, 0xad24);
11936 rtl8168_mdio_write(tp, 0x06, 0x3ae0);
11937 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
11938 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
11939 rtl8168_mdio_write(tp, 0x06, 0xeb58);
11940 rtl8168_mdio_write(tp, 0x06, 0xf8d1);
11941 rtl8168_mdio_write(tp, 0x06, 0x01e4);
11942 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
11943 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
11944 rtl8168_mdio_write(tp, 0x06, 0xebe0);
11945 rtl8168_mdio_write(tp, 0x06, 0xe07c);
11946 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
11947 rtl8168_mdio_write(tp, 0x06, 0x7d5c);
11948 rtl8168_mdio_write(tp, 0x06, 0x00ff);
11949 rtl8168_mdio_write(tp, 0x06, 0x3c00);
11950 rtl8168_mdio_write(tp, 0x06, 0x1eab);
11951 rtl8168_mdio_write(tp, 0x06, 0x1ce0);
11952 rtl8168_mdio_write(tp, 0x06, 0xe04c);
11953 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
11954 rtl8168_mdio_write(tp, 0x06, 0x4d58);
11955 rtl8168_mdio_write(tp, 0x06, 0xc1e4);
11956 rtl8168_mdio_write(tp, 0x06, 0xe04c);
11957 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
11958 rtl8168_mdio_write(tp, 0x06, 0x4de0);
11959 rtl8168_mdio_write(tp, 0x06, 0xe0ee);
11960 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
11961 rtl8168_mdio_write(tp, 0x06, 0xef69);
11962 rtl8168_mdio_write(tp, 0x06, 0x3ce4);
11963 rtl8168_mdio_write(tp, 0x06, 0xe0ee);
11964 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
11965 rtl8168_mdio_write(tp, 0x06, 0xeffc);
11966 rtl8168_mdio_write(tp, 0x06, 0x04f8);
11967 rtl8168_mdio_write(tp, 0x06, 0xe08b);
11968 rtl8168_mdio_write(tp, 0x06, 0x87ad);
11969 rtl8168_mdio_write(tp, 0x06, 0x2412);
11970 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
11971 rtl8168_mdio_write(tp, 0x06, 0xeee1);
11972 rtl8168_mdio_write(tp, 0x06, 0xe0ef);
11973 rtl8168_mdio_write(tp, 0x06, 0x59c3);
11974 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
11975 rtl8168_mdio_write(tp, 0x06, 0xeee5);
11976 rtl8168_mdio_write(tp, 0x06, 0xe0ef);
11977 rtl8168_mdio_write(tp, 0x06, 0xee8a);
11978 rtl8168_mdio_write(tp, 0x06, 0xed01);
11979 rtl8168_mdio_write(tp, 0x06, 0xfc04);
11980 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
11981 rtl8168_mdio_write(tp, 0x06, 0x8b81);
11982 rtl8168_mdio_write(tp, 0x06, 0xac25);
11983 rtl8168_mdio_write(tp, 0x06, 0x0502);
11984 rtl8168_mdio_write(tp, 0x06, 0x8363);
11985 rtl8168_mdio_write(tp, 0x06, 0xae03);
11986 rtl8168_mdio_write(tp, 0x06, 0x0225);
11987 rtl8168_mdio_write(tp, 0x06, 0x16fc);
11988 rtl8168_mdio_write(tp, 0x06, 0x04f8);
11989 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
11990 rtl8168_mdio_write(tp, 0x06, 0xef69);
11991 rtl8168_mdio_write(tp, 0x06, 0xfae0);
11992 rtl8168_mdio_write(tp, 0x06, 0x860a);
11993 rtl8168_mdio_write(tp, 0x06, 0xa000);
11994 rtl8168_mdio_write(tp, 0x06, 0x19e0);
11995 rtl8168_mdio_write(tp, 0x06, 0x860b);
11996 rtl8168_mdio_write(tp, 0x06, 0xe18b);
11997 rtl8168_mdio_write(tp, 0x06, 0x331b);
11998 rtl8168_mdio_write(tp, 0x06, 0x109e);
11999 rtl8168_mdio_write(tp, 0x06, 0x04aa);
12000 rtl8168_mdio_write(tp, 0x06, 0x02ae);
12001 rtl8168_mdio_write(tp, 0x06, 0x06ee);
12002 rtl8168_mdio_write(tp, 0x06, 0x860a);
12003 rtl8168_mdio_write(tp, 0x06, 0x01ae);
12004 rtl8168_mdio_write(tp, 0x06, 0xe602);
12005 rtl8168_mdio_write(tp, 0x06, 0x241e);
12006 rtl8168_mdio_write(tp, 0x06, 0xae14);
12007 rtl8168_mdio_write(tp, 0x06, 0xa001);
12008 rtl8168_mdio_write(tp, 0x06, 0x1402);
12009 rtl8168_mdio_write(tp, 0x06, 0x2426);
12010 rtl8168_mdio_write(tp, 0x06, 0xbf26);
12011 rtl8168_mdio_write(tp, 0x06, 0x6d02);
12012 rtl8168_mdio_write(tp, 0x06, 0x2eb0);
12013 rtl8168_mdio_write(tp, 0x06, 0xee86);
12014 rtl8168_mdio_write(tp, 0x06, 0x0b00);
12015 rtl8168_mdio_write(tp, 0x06, 0xee86);
12016 rtl8168_mdio_write(tp, 0x06, 0x0a02);
12017 rtl8168_mdio_write(tp, 0x06, 0xaf84);
12018 rtl8168_mdio_write(tp, 0x06, 0x3ca0);
12019 rtl8168_mdio_write(tp, 0x06, 0x0252);
12020 rtl8168_mdio_write(tp, 0x06, 0xee86);
12021 rtl8168_mdio_write(tp, 0x06, 0x0400);
12022 rtl8168_mdio_write(tp, 0x06, 0xee86);
12023 rtl8168_mdio_write(tp, 0x06, 0x0500);
12024 rtl8168_mdio_write(tp, 0x06, 0xe086);
12025 rtl8168_mdio_write(tp, 0x06, 0x0be1);
12026 rtl8168_mdio_write(tp, 0x06, 0x8b32);
12027 rtl8168_mdio_write(tp, 0x06, 0x1b10);
12028 rtl8168_mdio_write(tp, 0x06, 0x9e04);
12029 rtl8168_mdio_write(tp, 0x06, 0xaa02);
12030 rtl8168_mdio_write(tp, 0x06, 0xaecb);
12031 rtl8168_mdio_write(tp, 0x06, 0xee86);
12032 rtl8168_mdio_write(tp, 0x06, 0x0b00);
12033 rtl8168_mdio_write(tp, 0x06, 0x0224);
12034 rtl8168_mdio_write(tp, 0x06, 0x3ae2);
12035 rtl8168_mdio_write(tp, 0x06, 0x8604);
12036 rtl8168_mdio_write(tp, 0x06, 0xe386);
12037 rtl8168_mdio_write(tp, 0x06, 0x05ef);
12038 rtl8168_mdio_write(tp, 0x06, 0x65e2);
12039 rtl8168_mdio_write(tp, 0x06, 0x8606);
12040 rtl8168_mdio_write(tp, 0x06, 0xe386);
12041 rtl8168_mdio_write(tp, 0x06, 0x071b);
12042 rtl8168_mdio_write(tp, 0x06, 0x56aa);
12043 rtl8168_mdio_write(tp, 0x06, 0x0eef);
12044 rtl8168_mdio_write(tp, 0x06, 0x56e6);
12045 rtl8168_mdio_write(tp, 0x06, 0x8606);
12046 rtl8168_mdio_write(tp, 0x06, 0xe786);
12047 rtl8168_mdio_write(tp, 0x06, 0x07e2);
12048 rtl8168_mdio_write(tp, 0x06, 0x8609);
12049 rtl8168_mdio_write(tp, 0x06, 0xe686);
12050 rtl8168_mdio_write(tp, 0x06, 0x08e0);
12051 rtl8168_mdio_write(tp, 0x06, 0x8609);
12052 rtl8168_mdio_write(tp, 0x06, 0xa000);
12053 rtl8168_mdio_write(tp, 0x06, 0x07ee);
12054 rtl8168_mdio_write(tp, 0x06, 0x860a);
12055 rtl8168_mdio_write(tp, 0x06, 0x03af);
12056 rtl8168_mdio_write(tp, 0x06, 0x8369);
12057 rtl8168_mdio_write(tp, 0x06, 0x0224);
12058 rtl8168_mdio_write(tp, 0x06, 0x8e02);
12059 rtl8168_mdio_write(tp, 0x06, 0x2426);
12060 rtl8168_mdio_write(tp, 0x06, 0xae48);
12061 rtl8168_mdio_write(tp, 0x06, 0xa003);
12062 rtl8168_mdio_write(tp, 0x06, 0x21e0);
12063 rtl8168_mdio_write(tp, 0x06, 0x8608);
12064 rtl8168_mdio_write(tp, 0x06, 0xe186);
12065 rtl8168_mdio_write(tp, 0x06, 0x091b);
12066 rtl8168_mdio_write(tp, 0x06, 0x019e);
12067 rtl8168_mdio_write(tp, 0x06, 0x0caa);
12068 rtl8168_mdio_write(tp, 0x06, 0x0502);
12069 rtl8168_mdio_write(tp, 0x06, 0x249d);
12070 rtl8168_mdio_write(tp, 0x06, 0xaee7);
12071 rtl8168_mdio_write(tp, 0x06, 0x0224);
12072 rtl8168_mdio_write(tp, 0x06, 0x8eae);
12073 rtl8168_mdio_write(tp, 0x06, 0xe2ee);
12074 rtl8168_mdio_write(tp, 0x06, 0x860a);
12075 rtl8168_mdio_write(tp, 0x06, 0x04ee);
12076 rtl8168_mdio_write(tp, 0x06, 0x860b);
12077 rtl8168_mdio_write(tp, 0x06, 0x00af);
12078 rtl8168_mdio_write(tp, 0x06, 0x8369);
12079 rtl8168_mdio_write(tp, 0x06, 0xa004);
12080 rtl8168_mdio_write(tp, 0x06, 0x15e0);
12081 rtl8168_mdio_write(tp, 0x06, 0x860b);
12082 rtl8168_mdio_write(tp, 0x06, 0xe18b);
12083 rtl8168_mdio_write(tp, 0x06, 0x341b);
12084 rtl8168_mdio_write(tp, 0x06, 0x109e);
12085 rtl8168_mdio_write(tp, 0x06, 0x05aa);
12086 rtl8168_mdio_write(tp, 0x06, 0x03af);
12087 rtl8168_mdio_write(tp, 0x06, 0x8383);
12088 rtl8168_mdio_write(tp, 0x06, 0xee86);
12089 rtl8168_mdio_write(tp, 0x06, 0x0a05);
12090 rtl8168_mdio_write(tp, 0x06, 0xae0c);
12091 rtl8168_mdio_write(tp, 0x06, 0xa005);
12092 rtl8168_mdio_write(tp, 0x06, 0x02ae);
12093 rtl8168_mdio_write(tp, 0x06, 0x0702);
12094 rtl8168_mdio_write(tp, 0x06, 0x2309);
12095 rtl8168_mdio_write(tp, 0x06, 0xee86);
12096 rtl8168_mdio_write(tp, 0x06, 0x0a00);
12097 rtl8168_mdio_write(tp, 0x06, 0xfeef);
12098 rtl8168_mdio_write(tp, 0x06, 0x96fe);
12099 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
12100 rtl8168_mdio_write(tp, 0x06, 0x04f8);
12101 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
12102 rtl8168_mdio_write(tp, 0x06, 0xef69);
12103 rtl8168_mdio_write(tp, 0x06, 0xfbe0);
12104 rtl8168_mdio_write(tp, 0x06, 0x8b85);
12105 rtl8168_mdio_write(tp, 0x06, 0xad25);
12106 rtl8168_mdio_write(tp, 0x06, 0x22e0);
12107 rtl8168_mdio_write(tp, 0x06, 0xe022);
12108 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
12109 rtl8168_mdio_write(tp, 0x06, 0x23e2);
12110 rtl8168_mdio_write(tp, 0x06, 0xe036);
12111 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
12112 rtl8168_mdio_write(tp, 0x06, 0x375a);
12113 rtl8168_mdio_write(tp, 0x06, 0xc40d);
12114 rtl8168_mdio_write(tp, 0x06, 0x0158);
12115 rtl8168_mdio_write(tp, 0x06, 0x021e);
12116 rtl8168_mdio_write(tp, 0x06, 0x20e3);
12117 rtl8168_mdio_write(tp, 0x06, 0x8ae7);
12118 rtl8168_mdio_write(tp, 0x06, 0xac31);
12119 rtl8168_mdio_write(tp, 0x06, 0x60ac);
12120 rtl8168_mdio_write(tp, 0x06, 0x3a08);
12121 rtl8168_mdio_write(tp, 0x06, 0xac3e);
12122 rtl8168_mdio_write(tp, 0x06, 0x26ae);
12123 rtl8168_mdio_write(tp, 0x06, 0x67af);
12124 rtl8168_mdio_write(tp, 0x06, 0x84db);
12125 rtl8168_mdio_write(tp, 0x06, 0xad37);
12126 rtl8168_mdio_write(tp, 0x06, 0x61e0);
12127 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
12128 rtl8168_mdio_write(tp, 0x06, 0x10e4);
12129 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
12130 rtl8168_mdio_write(tp, 0x06, 0xe18a);
12131 rtl8168_mdio_write(tp, 0x06, 0xe91b);
12132 rtl8168_mdio_write(tp, 0x06, 0x109e);
12133 rtl8168_mdio_write(tp, 0x06, 0x02ae);
12134 rtl8168_mdio_write(tp, 0x06, 0x51d1);
12135 rtl8168_mdio_write(tp, 0x06, 0x00bf);
12136 rtl8168_mdio_write(tp, 0x06, 0x863b);
12137 rtl8168_mdio_write(tp, 0x06, 0x022f);
12138 rtl8168_mdio_write(tp, 0x06, 0x50ee);
12139 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
12140 rtl8168_mdio_write(tp, 0x06, 0x00ae);
12141 rtl8168_mdio_write(tp, 0x06, 0x43ad);
12142 rtl8168_mdio_write(tp, 0x06, 0x3627);
12143 rtl8168_mdio_write(tp, 0x06, 0xe08a);
12144 rtl8168_mdio_write(tp, 0x06, 0xeee1);
12145 rtl8168_mdio_write(tp, 0x06, 0x8aef);
12146 rtl8168_mdio_write(tp, 0x06, 0xef74);
12147 rtl8168_mdio_write(tp, 0x06, 0xe08a);
12148 rtl8168_mdio_write(tp, 0x06, 0xeae1);
12149 rtl8168_mdio_write(tp, 0x06, 0x8aeb);
12150 rtl8168_mdio_write(tp, 0x06, 0x1b74);
12151 rtl8168_mdio_write(tp, 0x06, 0x9e2e);
12152 rtl8168_mdio_write(tp, 0x06, 0x14e4);
12153 rtl8168_mdio_write(tp, 0x06, 0x8aea);
12154 rtl8168_mdio_write(tp, 0x06, 0xe58a);
12155 rtl8168_mdio_write(tp, 0x06, 0xebef);
12156 rtl8168_mdio_write(tp, 0x06, 0x74e0);
12157 rtl8168_mdio_write(tp, 0x06, 0x8aee);
12158 rtl8168_mdio_write(tp, 0x06, 0xe18a);
12159 rtl8168_mdio_write(tp, 0x06, 0xef1b);
12160 rtl8168_mdio_write(tp, 0x06, 0x479e);
12161 rtl8168_mdio_write(tp, 0x06, 0x0fae);
12162 rtl8168_mdio_write(tp, 0x06, 0x19ee);
12163 rtl8168_mdio_write(tp, 0x06, 0x8aea);
12164 rtl8168_mdio_write(tp, 0x06, 0x00ee);
12165 rtl8168_mdio_write(tp, 0x06, 0x8aeb);
12166 rtl8168_mdio_write(tp, 0x06, 0x00ae);
12167 rtl8168_mdio_write(tp, 0x06, 0x0fac);
12168 rtl8168_mdio_write(tp, 0x06, 0x390c);
12169 rtl8168_mdio_write(tp, 0x06, 0xd101);
12170 rtl8168_mdio_write(tp, 0x06, 0xbf86);
12171 rtl8168_mdio_write(tp, 0x06, 0x3b02);
12172 rtl8168_mdio_write(tp, 0x06, 0x2f50);
12173 rtl8168_mdio_write(tp, 0x06, 0xee8a);
12174 rtl8168_mdio_write(tp, 0x06, 0xe800);
12175 rtl8168_mdio_write(tp, 0x06, 0xe68a);
12176 rtl8168_mdio_write(tp, 0x06, 0xe7ff);
12177 rtl8168_mdio_write(tp, 0x06, 0xef96);
12178 rtl8168_mdio_write(tp, 0x06, 0xfefd);
12179 rtl8168_mdio_write(tp, 0x06, 0xfc04);
12180 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
12181 rtl8168_mdio_write(tp, 0x06, 0xfaef);
12182 rtl8168_mdio_write(tp, 0x06, 0x69e0);
12183 rtl8168_mdio_write(tp, 0x06, 0xe022);
12184 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
12185 rtl8168_mdio_write(tp, 0x06, 0x2358);
12186 rtl8168_mdio_write(tp, 0x06, 0xc4e1);
12187 rtl8168_mdio_write(tp, 0x06, 0x8b6e);
12188 rtl8168_mdio_write(tp, 0x06, 0x1f10);
12189 rtl8168_mdio_write(tp, 0x06, 0x9e24);
12190 rtl8168_mdio_write(tp, 0x06, 0xe48b);
12191 rtl8168_mdio_write(tp, 0x06, 0x6ead);
12192 rtl8168_mdio_write(tp, 0x06, 0x2218);
12193 rtl8168_mdio_write(tp, 0x06, 0xac27);
12194 rtl8168_mdio_write(tp, 0x06, 0x0dac);
12195 rtl8168_mdio_write(tp, 0x06, 0x2605);
12196 rtl8168_mdio_write(tp, 0x06, 0x0203);
12197 rtl8168_mdio_write(tp, 0x06, 0x8fae);
12198 rtl8168_mdio_write(tp, 0x06, 0x1302);
12199 rtl8168_mdio_write(tp, 0x06, 0x03c8);
12200 rtl8168_mdio_write(tp, 0x06, 0xae0e);
12201 rtl8168_mdio_write(tp, 0x06, 0x0203);
12202 rtl8168_mdio_write(tp, 0x06, 0xe102);
12203 rtl8168_mdio_write(tp, 0x06, 0x8520);
12204 rtl8168_mdio_write(tp, 0x06, 0xae06);
12205 rtl8168_mdio_write(tp, 0x06, 0x0203);
12206 rtl8168_mdio_write(tp, 0x06, 0x8f02);
12207 rtl8168_mdio_write(tp, 0x06, 0x8566);
12208 rtl8168_mdio_write(tp, 0x06, 0xef96);
12209 rtl8168_mdio_write(tp, 0x06, 0xfefd);
12210 rtl8168_mdio_write(tp, 0x06, 0xfc04);
12211 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
12212 rtl8168_mdio_write(tp, 0x06, 0xef69);
12213 rtl8168_mdio_write(tp, 0x06, 0xe08b);
12214 rtl8168_mdio_write(tp, 0x06, 0x82ad);
12215 rtl8168_mdio_write(tp, 0x06, 0x2737);
12216 rtl8168_mdio_write(tp, 0x06, 0xbf86);
12217 rtl8168_mdio_write(tp, 0x06, 0x4402);
12218 rtl8168_mdio_write(tp, 0x06, 0x2f23);
12219 rtl8168_mdio_write(tp, 0x06, 0xac28);
12220 rtl8168_mdio_write(tp, 0x06, 0x2ed1);
12221 rtl8168_mdio_write(tp, 0x06, 0x01bf);
12222 rtl8168_mdio_write(tp, 0x06, 0x8647);
12223 rtl8168_mdio_write(tp, 0x06, 0x022f);
12224 rtl8168_mdio_write(tp, 0x06, 0x50bf);
12225 rtl8168_mdio_write(tp, 0x06, 0x8641);
12226 rtl8168_mdio_write(tp, 0x06, 0x022f);
12227 rtl8168_mdio_write(tp, 0x06, 0x23e5);
12228 rtl8168_mdio_write(tp, 0x06, 0x8af0);
12229 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
12230 rtl8168_mdio_write(tp, 0x06, 0x22e1);
12231 rtl8168_mdio_write(tp, 0x06, 0xe023);
12232 rtl8168_mdio_write(tp, 0x06, 0xac2e);
12233 rtl8168_mdio_write(tp, 0x06, 0x04d1);
12234 rtl8168_mdio_write(tp, 0x06, 0x01ae);
12235 rtl8168_mdio_write(tp, 0x06, 0x02d1);
12236 rtl8168_mdio_write(tp, 0x06, 0x00bf);
12237 rtl8168_mdio_write(tp, 0x06, 0x8641);
12238 rtl8168_mdio_write(tp, 0x06, 0x022f);
12239 rtl8168_mdio_write(tp, 0x06, 0x50d1);
12240 rtl8168_mdio_write(tp, 0x06, 0x01bf);
12241 rtl8168_mdio_write(tp, 0x06, 0x8644);
12242 rtl8168_mdio_write(tp, 0x06, 0x022f);
12243 rtl8168_mdio_write(tp, 0x06, 0x50ef);
12244 rtl8168_mdio_write(tp, 0x06, 0x96fe);
12245 rtl8168_mdio_write(tp, 0x06, 0xfc04);
12246 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
12247 rtl8168_mdio_write(tp, 0x06, 0xef69);
12248 rtl8168_mdio_write(tp, 0x06, 0xbf86);
12249 rtl8168_mdio_write(tp, 0x06, 0x4702);
12250 rtl8168_mdio_write(tp, 0x06, 0x2f23);
12251 rtl8168_mdio_write(tp, 0x06, 0xad28);
12252 rtl8168_mdio_write(tp, 0x06, 0x19d1);
12253 rtl8168_mdio_write(tp, 0x06, 0x00bf);
12254 rtl8168_mdio_write(tp, 0x06, 0x8644);
12255 rtl8168_mdio_write(tp, 0x06, 0x022f);
12256 rtl8168_mdio_write(tp, 0x06, 0x50e1);
12257 rtl8168_mdio_write(tp, 0x06, 0x8af0);
12258 rtl8168_mdio_write(tp, 0x06, 0xbf86);
12259 rtl8168_mdio_write(tp, 0x06, 0x4102);
12260 rtl8168_mdio_write(tp, 0x06, 0x2f50);
12261 rtl8168_mdio_write(tp, 0x06, 0xd100);
12262 rtl8168_mdio_write(tp, 0x06, 0xbf86);
12263 rtl8168_mdio_write(tp, 0x06, 0x4702);
12264 rtl8168_mdio_write(tp, 0x06, 0x2f50);
12265 rtl8168_mdio_write(tp, 0x06, 0xef96);
12266 rtl8168_mdio_write(tp, 0x06, 0xfefc);
12267 rtl8168_mdio_write(tp, 0x06, 0x04f8);
12268 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
12269 rtl8168_mdio_write(tp, 0x06, 0xfee1);
12270 rtl8168_mdio_write(tp, 0x06, 0xe2ff);
12271 rtl8168_mdio_write(tp, 0x06, 0xad2e);
12272 rtl8168_mdio_write(tp, 0x06, 0x63e0);
12273 rtl8168_mdio_write(tp, 0x06, 0xe038);
12274 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
12275 rtl8168_mdio_write(tp, 0x06, 0x39ad);
12276 rtl8168_mdio_write(tp, 0x06, 0x2f10);
12277 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
12278 rtl8168_mdio_write(tp, 0x06, 0x34e1);
12279 rtl8168_mdio_write(tp, 0x06, 0xe035);
12280 rtl8168_mdio_write(tp, 0x06, 0xf726);
12281 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
12282 rtl8168_mdio_write(tp, 0x06, 0x34e5);
12283 rtl8168_mdio_write(tp, 0x06, 0xe035);
12284 rtl8168_mdio_write(tp, 0x06, 0xae0e);
12285 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
12286 rtl8168_mdio_write(tp, 0x06, 0xd6e1);
12287 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
12288 rtl8168_mdio_write(tp, 0x06, 0xf728);
12289 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
12290 rtl8168_mdio_write(tp, 0x06, 0xd6e5);
12291 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
12292 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
12293 rtl8168_mdio_write(tp, 0x06, 0x34e1);
12294 rtl8168_mdio_write(tp, 0x06, 0xe235);
12295 rtl8168_mdio_write(tp, 0x06, 0xf72b);
12296 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
12297 rtl8168_mdio_write(tp, 0x06, 0x34e5);
12298 rtl8168_mdio_write(tp, 0x06, 0xe235);
12299 rtl8168_mdio_write(tp, 0x06, 0xd07d);
12300 rtl8168_mdio_write(tp, 0x06, 0xb0fe);
12301 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
12302 rtl8168_mdio_write(tp, 0x06, 0x34e1);
12303 rtl8168_mdio_write(tp, 0x06, 0xe235);
12304 rtl8168_mdio_write(tp, 0x06, 0xf62b);
12305 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
12306 rtl8168_mdio_write(tp, 0x06, 0x34e5);
12307 rtl8168_mdio_write(tp, 0x06, 0xe235);
12308 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
12309 rtl8168_mdio_write(tp, 0x06, 0x34e1);
12310 rtl8168_mdio_write(tp, 0x06, 0xe035);
12311 rtl8168_mdio_write(tp, 0x06, 0xf626);
12312 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
12313 rtl8168_mdio_write(tp, 0x06, 0x34e5);
12314 rtl8168_mdio_write(tp, 0x06, 0xe035);
12315 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
12316 rtl8168_mdio_write(tp, 0x06, 0xd6e1);
12317 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
12318 rtl8168_mdio_write(tp, 0x06, 0xf628);
12319 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
12320 rtl8168_mdio_write(tp, 0x06, 0xd6e5);
12321 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
12322 rtl8168_mdio_write(tp, 0x06, 0xfc04);
12323 rtl8168_mdio_write(tp, 0x06, 0xae20);
12324 rtl8168_mdio_write(tp, 0x06, 0x0000);
12325 rtl8168_mdio_write(tp, 0x06, 0x0000);
12326 rtl8168_mdio_write(tp, 0x06, 0x0000);
12327 rtl8168_mdio_write(tp, 0x06, 0x0000);
12328 rtl8168_mdio_write(tp, 0x06, 0x0000);
12329 rtl8168_mdio_write(tp, 0x06, 0x0000);
12330 rtl8168_mdio_write(tp, 0x06, 0x0000);
12331 rtl8168_mdio_write(tp, 0x06, 0x0000);
12332 rtl8168_mdio_write(tp, 0x06, 0x0000);
12333 rtl8168_mdio_write(tp, 0x06, 0x0000);
12334 rtl8168_mdio_write(tp, 0x06, 0x0000);
12335 rtl8168_mdio_write(tp, 0x06, 0x0000);
12336 rtl8168_mdio_write(tp, 0x06, 0x0000);
12337 rtl8168_mdio_write(tp, 0x06, 0x0000);
12338 rtl8168_mdio_write(tp, 0x06, 0x0000);
12339 rtl8168_mdio_write(tp, 0x06, 0x0000);
12340 rtl8168_mdio_write(tp, 0x06, 0xa725);
12341 rtl8168_mdio_write(tp, 0x06, 0xe50a);
12342 rtl8168_mdio_write(tp, 0x06, 0x1de5);
12343 rtl8168_mdio_write(tp, 0x06, 0x0a2c);
12344 rtl8168_mdio_write(tp, 0x06, 0xe50a);
12345 rtl8168_mdio_write(tp, 0x06, 0x6de5);
12346 rtl8168_mdio_write(tp, 0x06, 0x0a1d);
12347 rtl8168_mdio_write(tp, 0x06, 0xe50a);
12348 rtl8168_mdio_write(tp, 0x06, 0x1ce5);
12349 rtl8168_mdio_write(tp, 0x06, 0x0a2d);
12350 rtl8168_mdio_write(tp, 0x06, 0xa755);
12351 rtl8168_mdio_write(tp, 0x06, 0x00e2);
12352 rtl8168_mdio_write(tp, 0x06, 0x3488);
12353 rtl8168_mdio_write(tp, 0x06, 0xe200);
12354 rtl8168_mdio_write(tp, 0x06, 0xcce2);
12355 rtl8168_mdio_write(tp, 0x06, 0x0055);
12356 rtl8168_mdio_write(tp, 0x06, 0xe020);
12357 rtl8168_mdio_write(tp, 0x06, 0x55e2);
12358 rtl8168_mdio_write(tp, 0x06, 0xd600);
12359 rtl8168_mdio_write(tp, 0x06, 0xe24a);
12360 gphy_val = rtl8168_mdio_read(tp, 0x01);
12361 gphy_val |= BIT_0;
12362 rtl8168_mdio_write(tp, 0x01, gphy_val);
12363 gphy_val = rtl8168_mdio_read(tp, 0x00);
12364 gphy_val |= BIT_0;
12365 rtl8168_mdio_write(tp, 0x00, gphy_val);
12366 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12367
12368 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12369 rtl8168_mdio_write(tp, 0x17, 0x2179);
12370 rtl8168_mdio_write(tp, 0x1f, 0x0001);
12371 rtl8168_mdio_write(tp, 0x10, 0xf274);
12372 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12373 rtl8168_mdio_write(tp, 0x1e, 0x0042);
12374 rtl8168_mdio_write(tp, 0x15, 0x0f00);
12375 rtl8168_mdio_write(tp, 0x15, 0x0f00);
12376 rtl8168_mdio_write(tp, 0x16, 0x7408);
12377 rtl8168_mdio_write(tp, 0x15, 0x0e00);
12378 rtl8168_mdio_write(tp, 0x15, 0x0f00);
12379 rtl8168_mdio_write(tp, 0x15, 0x0f01);
12380 rtl8168_mdio_write(tp, 0x16, 0x4000);
12381 rtl8168_mdio_write(tp, 0x15, 0x0e01);
12382 rtl8168_mdio_write(tp, 0x15, 0x0f01);
12383 rtl8168_mdio_write(tp, 0x15, 0x0f02);
12384 rtl8168_mdio_write(tp, 0x16, 0x9400);
12385 rtl8168_mdio_write(tp, 0x15, 0x0e02);
12386 rtl8168_mdio_write(tp, 0x15, 0x0f02);
12387 rtl8168_mdio_write(tp, 0x15, 0x0f03);
12388 rtl8168_mdio_write(tp, 0x16, 0x7408);
12389 rtl8168_mdio_write(tp, 0x15, 0x0e03);
12390 rtl8168_mdio_write(tp, 0x15, 0x0f03);
12391 rtl8168_mdio_write(tp, 0x15, 0x0f04);
12392 rtl8168_mdio_write(tp, 0x16, 0x4008);
12393 rtl8168_mdio_write(tp, 0x15, 0x0e04);
12394 rtl8168_mdio_write(tp, 0x15, 0x0f04);
12395 rtl8168_mdio_write(tp, 0x15, 0x0f05);
12396 rtl8168_mdio_write(tp, 0x16, 0x9400);
12397 rtl8168_mdio_write(tp, 0x15, 0x0e05);
12398 rtl8168_mdio_write(tp, 0x15, 0x0f05);
12399 rtl8168_mdio_write(tp, 0x15, 0x0f06);
12400 rtl8168_mdio_write(tp, 0x16, 0x0803);
12401 rtl8168_mdio_write(tp, 0x15, 0x0e06);
12402 rtl8168_mdio_write(tp, 0x15, 0x0f06);
12403 rtl8168_mdio_write(tp, 0x15, 0x0d00);
12404 rtl8168_mdio_write(tp, 0x15, 0x0100);
12405 rtl8168_mdio_write(tp, 0x1f, 0x0001);
12406 rtl8168_mdio_write(tp, 0x10, 0xf074);
12407 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12408 rtl8168_mdio_write(tp, 0x17, 0x2149);
12409
12410 rtl8168_mdio_write(tp, 0x1f, 0x0005);
12411 for (i = 0; i < 200; i++) {
12412 udelay(100);
12413 gphy_val = rtl8168_mdio_read(tp, 0x00);
12414 if (gphy_val & BIT_7)
12415 break;
12416 }
12417 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12418 rtl8168_mdio_write(tp, 0x1e, 0x0023);
12419 gphy_val = rtl8168_mdio_read(tp, 0x17);
12420 gphy_val &= ~(BIT_0);
12421 if (tp->RequiredSecLanDonglePatch)
12422 gphy_val &= ~(BIT_2);
12423 rtl8168_mdio_write(tp, 0x17, gphy_val);
12424 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12425 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12426 rtl8168_mdio_write(tp, 0x1e, 0x0023);
12427 gphy_val = rtl8168_mdio_read(tp, 0x17);
12428 gphy_val |= BIT_14;
12429 rtl8168_mdio_write(tp, 0x17, gphy_val);
12430 rtl8168_mdio_write(tp, 0x1e, 0x0020);
12431 gphy_val = rtl8168_mdio_read(tp, 0x1b);
12432 gphy_val |= BIT_7;
12433 rtl8168_mdio_write(tp, 0x1b, gphy_val);
12434 rtl8168_mdio_write(tp, 0x1e, 0x0041);
12435 rtl8168_mdio_write(tp, 0x15, 0x0e02);
12436 rtl8168_mdio_write(tp, 0x1e, 0x0028);
12437 gphy_val = rtl8168_mdio_read(tp, 0x19);
12438 gphy_val |= BIT_15;
12439 rtl8168_mdio_write(tp, 0x19, gphy_val);
12440 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12441 } else {
12442 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12443 rtl8168_mdio_write(tp, 0x00, 0x1800);
12444 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12445 rtl8168_mdio_write(tp, 0x1e, 0x0023);
12446 rtl8168_mdio_write(tp, 0x17, 0x0117);
12447 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12448 rtl8168_mdio_write(tp, 0x1E, 0x002C);
12449 rtl8168_mdio_write(tp, 0x1B, 0x5000);
12450 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12451 rtl8168_mdio_write(tp, 0x16, 0x4104);
12452 for (i = 0; i < 200; i++) {
12453 udelay(100);
12454 gphy_val = rtl8168_mdio_read(tp, 0x1E);
12455 gphy_val &= 0x03FF;
12456 if (gphy_val==0x000C)
12457 break;
12458 }
12459 rtl8168_mdio_write(tp, 0x1f, 0x0005);
12460 for (i = 0; i < 200; i++) {
12461 udelay(100);
12462 gphy_val = rtl8168_mdio_read(tp, 0x07);
12463 if ((gphy_val & BIT_5) == 0)
12464 break;
12465 }
12466 gphy_val = rtl8168_mdio_read(tp, 0x07);
12467 if (gphy_val & BIT_5) {
12468 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12469 rtl8168_mdio_write(tp, 0x1e, 0x00a1);
12470 rtl8168_mdio_write(tp, 0x17, 0x1000);
12471 rtl8168_mdio_write(tp, 0x17, 0x0000);
12472 rtl8168_mdio_write(tp, 0x17, 0x2000);
12473 rtl8168_mdio_write(tp, 0x1e, 0x002f);
12474 rtl8168_mdio_write(tp, 0x18, 0x9bfb);
12475 rtl8168_mdio_write(tp, 0x1f, 0x0005);
12476 rtl8168_mdio_write(tp, 0x07, 0x0000);
12477 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12478 }
12479 rtl8168_mdio_write(tp, 0x1f, 0x0005);
12480 rtl8168_mdio_write(tp, 0x05, 0xfff6);
12481 rtl8168_mdio_write(tp, 0x06, 0x0080);
12482 gphy_val = rtl8168_mdio_read(tp, 0x00);
12483 gphy_val &= ~(BIT_7);
12484 rtl8168_mdio_write(tp, 0x00, gphy_val);
12485 rtl8168_mdio_write(tp, 0x1f, 0x0002);
12486 gphy_val = rtl8168_mdio_read(tp, 0x08);
12487 gphy_val &= ~(BIT_7);
12488 rtl8168_mdio_write(tp, 0x08, gphy_val);
12489 rtl8168_mdio_write(tp, 0x1f, 0x0000);
12490
12491 rtl8168_mdio_write(tp, 0x1f, 0x0007);
12492 rtl8168_mdio_write(tp, 0x1e, 0x0023);
12493 rtl8168_mdio_write(tp, 0x16, 0x0306);
12494 rtl8168_mdio_write(tp, 0x16, 0x0307);
12495 rtl8168_mdio_write(tp, 0x15, 0x000e);
12496 rtl8168_mdio_write(tp, 0x19, 0x000a);
12497 rtl8168_mdio_write(tp, 0x15, 0x0010);
12498 rtl8168_mdio_write(tp, 0x19, 0x0008);
12499 rtl8168_mdio_write(tp, 0x15, 0x0018);
12500 rtl8168_mdio_write(tp, 0x19, 0x4801);
12501 rtl8168_mdio_write(tp, 0x15, 0x0019);
12502 rtl8168_mdio_write(tp, 0x19, 0x6801);
12503 rtl8168_mdio_write(tp, 0x15, 0x001a);
12504 rtl8168_mdio_write(tp, 0x19, 0x66a1);
12505 rtl8168_mdio_write(tp, 0x15, 0x001f);
12506 rtl8168_mdio_write(tp, 0x19, 0x0000);
12507 rtl8168_mdio_write(tp, 0x15, 0x0020);
12508 rtl8168_mdio_write(tp, 0x19, 0x0000);
12509 rtl8168_mdio_write(tp, 0x15, 0x0021);
12510 rtl8168_mdio_write(tp, 0x19, 0x0000);
12511 rtl8168_mdio_write(tp, 0x15, 0x0022);
12512 rtl8168_mdio_write(tp, 0x19, 0x0000);
12513 rtl8168_mdio_write(tp, 0x15, 0x0023);
12514 rtl8168_mdio_write(tp, 0x19, 0x0000);
12515 rtl8168_mdio_write(tp, 0x15, 0x0024);
12516 rtl8168_mdio_write(tp, 0x19, 0x0000);
12517 rtl8168_mdio_write(tp, 0x15, 0x0025);
12518 rtl8168_mdio_write(tp, 0x19, 0x64a1);
12519 rtl8168_mdio_write(tp, 0x15, 0x0026);
12520 rtl8168_mdio_write(tp, 0x19, 0x40ea);
12521 rtl8168_mdio_write(tp, 0x15, 0x0027);
12522 rtl8168_mdio_write(tp, 0x19, 0x4503);
12523 rtl8168_mdio_write(tp, 0x15, 0x0028);
12524 rtl8168_mdio_write(tp, 0x19, 0x9f00);
12525 rtl8168_mdio_write(tp, 0x15, 0x0029);
12526 rtl8168_mdio_write(tp, 0x19, 0xa631);
12527 rtl8168_mdio_write(tp, 0x15, 0x002a);
12528 rtl8168_mdio_write(tp, 0x19, 0x9717);
12529 rtl8168_mdio_write(tp, 0x15, 0x002b);
12530 rtl8168_mdio_write(tp, 0x19, 0x302c);
12531 rtl8168_mdio_write(tp, 0x15, 0x002c);
12532 rtl8168_mdio_write(tp, 0x19, 0x4802);
12533 rtl8168_mdio_write(tp, 0x15, 0x002d);
12534 rtl8168_mdio_write(tp, 0x19, 0x58da);
12535 rtl8168_mdio_write(tp, 0x15, 0x002e);
12536 rtl8168_mdio_write(tp, 0x19, 0x400d);
12537 rtl8168_mdio_write(tp, 0x15, 0x002f);
12538 rtl8168_mdio_write(tp, 0x19, 0x4488);
12539 rtl8168_mdio_write(tp, 0x15, 0x0030);
12540 rtl8168_mdio_write(tp, 0x19, 0x9e00);
12541 rtl8168_mdio_write(tp, 0x15, 0x0031);
12542 rtl8168_mdio_write(tp, 0x19, 0x63c8);
12543 rtl8168_mdio_write(tp, 0x15, 0x0032);
12544 rtl8168_mdio_write(tp, 0x19, 0x6481);
12545 rtl8168_mdio_write(tp, 0x15, 0x0033);
12546 rtl8168_mdio_write(tp, 0x19, 0x0000);
12547 rtl8168_mdio_write(tp, 0x15, 0x0034);
12548 rtl8168_mdio_write(tp, 0x19, 0x0000);
12549 rtl8168_mdio_write(tp, 0x15, 0x0035);
12550 rtl8168_mdio_write(tp, 0x19, 0x0000);
12551 rtl8168_mdio_write(tp, 0x15, 0x0036);
12552 rtl8168_mdio_write(tp, 0x19, 0x0000);
12553 rtl8168_mdio_write(tp, 0x15, 0x0037);
12554 rtl8168_mdio_write(tp, 0x19, 0x0000);
12555 rtl8168_mdio_write(tp, 0x15, 0x0038);
12556 rtl8168_mdio_write(tp, 0x19, 0x0000);
12557 rtl8168_mdio_write(tp, 0x15, 0x0039);
12558 rtl8168_mdio_write(tp, 0x19, 0x0000);
12559 rtl8168_mdio_write(tp, 0x15, 0x003a);
12560 rtl8168_mdio_write(tp, 0x19, 0x0000);
12561 rtl8168_mdio_write(tp, 0x15, 0x003b);
12562 rtl8168_mdio_write(tp, 0x19, 0x63e8);
12563 rtl8168_mdio_write(tp, 0x15, 0x003c);
12564 rtl8168_mdio_write(tp, 0x19, 0x7d00);
12565 rtl8168_mdio_write(tp, 0x15, 0x003d);
12566 rtl8168_mdio_write(tp, 0x19, 0x59d4);
12567 rtl8168_mdio_write(tp, 0x15, 0x003e);
12568 rtl8168_mdio_write(tp, 0x19, 0x63f8);
12569 rtl8168_mdio_write(tp, 0x15, 0x0040);
12570 rtl8168_mdio_write(tp, 0x19, 0x64a1);
12571 rtl8168_mdio_write(tp, 0x15, 0x0041);
12572 rtl8168_mdio_write(tp, 0x19, 0x30de);
12573 rtl8168_mdio_write(tp, 0x15, 0x0044);
12574 rtl8168_mdio_write(tp, 0x19, 0x480f);
12575 rtl8168_mdio_write(tp, 0x15, 0x0045);
12576 rtl8168_mdio_write(tp, 0x19, 0x6800);
12577 rtl8168_mdio_write(tp, 0x15, 0x0046);
12578 rtl8168_mdio_write(tp, 0x19, 0x6680);
12579 rtl8168_mdio_write(tp, 0x15, 0x0047);
12580 rtl8168_mdio_write(tp, 0x19, 0x7c10);
12581 rtl8168_mdio_write(tp, 0x15, 0x0048);
12582 rtl8168_mdio_write(tp, 0x19, 0x63c8);
12583 rtl8168_mdio_write(tp, 0x15, 0x0049);
12584 rtl8168_mdio_write(tp, 0x19, 0x0000);
12585 rtl8168_mdio_write(tp, 0x15, 0x004a);
12586 rtl8168_mdio_write(tp, 0x19, 0x0000);
12587 rtl8168_mdio_write(tp, 0x15, 0x004b);
12588 rtl8168_mdio_write(tp, 0x19, 0x0000);
12589 rtl8168_mdio_write(tp, 0x15, 0x004c);
12590 rtl8168_mdio_write(tp, 0x19, 0x0000);
12591 rtl8168_mdio_write(tp, 0x15, 0x004d);
12592 rtl8168_mdio_write(tp, 0x19, 0x0000);
12593 rtl8168_mdio_write(tp, 0x15, 0x004e);
12594 rtl8168_mdio_write(tp, 0x19, 0x0000);
12595 rtl8168_mdio_write(tp, 0x15, 0x004f);
12596 rtl8168_mdio_write(tp, 0x19, 0x40ea);
12597 rtl8168_mdio_write(tp, 0x15, 0x0050);
12598 rtl8168_mdio_write(tp, 0x19, 0x4503);
12599 rtl8168_mdio_write(tp, 0x15, 0x0051);
12600 rtl8168_mdio_write(tp, 0x19, 0x58ca);
12601 rtl8168_mdio_write(tp, 0x15, 0x0052);
12602 rtl8168_mdio_write(tp, 0x19, 0x63c8);
12603 rtl8168_mdio_write(tp, 0x15, 0x0053);
12604 rtl8168_mdio_write(tp, 0x19, 0x63d8);
12605 rtl8168_mdio_write(tp, 0x15, 0x0054);
12606 rtl8168_mdio_write(tp, 0x19, 0x66a0);
12607 rtl8168_mdio_write(tp, 0x15, 0x0055);
12608 rtl8168_mdio_write(tp, 0x19, 0x9f00);
12609 rtl8168_mdio_write(tp, 0x15, 0x0056);
12610 rtl8168_mdio_write(tp, 0x19, 0x3000);
12611 rtl8168_mdio_write(tp, 0x15, 0x00a1);
12612 rtl8168_mdio_write(tp, 0x19, 0x3044);
12613 rtl8168_mdio_write(tp, 0x15, 0x00ab);
12614 rtl8168_mdio_write(tp, 0x19, 0x5820);
12615 rtl8168_mdio_write(tp, 0x15, 0x00ac);
12616 rtl8168_mdio_write(tp, 0x19, 0x5e04);
12617 rtl8168_mdio_write(tp, 0x15, 0x00ad);
12618 rtl8168_mdio_write(tp, 0x19, 0xb60c);
12619 rtl8168_mdio_write(tp, 0x15, 0x00af);
12620 rtl8168_mdio_write(tp, 0x19, 0x000a);
12621 rtl8168_mdio_write(tp, 0x15, 0x00b2);
12622 rtl8168_mdio_write(tp, 0x19, 0x30b9);
12623 rtl8168_mdio_write(tp, 0x15, 0x00b9);
12624 rtl8168_mdio_write(tp, 0x19, 0x4408);
12625 rtl8168_mdio_write(tp, 0x15, 0x00ba);
12626 rtl8168_mdio_write(tp, 0x19, 0x480b);
12627 rtl8168_mdio_write(tp, 0x15, 0x00bb);
12628 rtl8168_mdio_write(tp, 0x19, 0x5e00);
12629 rtl8168_mdio_write(tp, 0x15, 0x00bc);
12630 rtl8168_mdio_write(tp, 0x19, 0x405f);
12631 rtl8168_mdio_write(tp, 0x15, 0x00bd);
12632 rtl8168_mdio_write(tp, 0x19, 0x4448);
12633 rtl8168_mdio_write(tp, 0x15, 0x00be);
12634 rtl8168_mdio_write(tp, 0x19, 0x4020);
12635 rtl8168_mdio_write(tp, 0x15, 0x00bf);
12636 rtl8168_mdio_write(tp, 0x19, 0x4468);
12637 rtl8168_mdio_write(tp, 0x15, 0x00c0);
12638 rtl8168_mdio_write(tp, 0x19, 0x9c02);
12639 rtl8168_mdio_write(tp, 0x15, 0x00c1);
12640 rtl8168_mdio_write(tp, 0x19, 0x58a0);
12641 rtl8168_mdio_write(tp, 0x15, 0x00c2);
12642 rtl8168_mdio_write(tp, 0x19, 0xb605);
12643 rtl8168_mdio_write(tp, 0x15, 0x00c3);
12644 rtl8168_mdio_write(tp, 0x19, 0xc0d3);
12645 rtl8168_mdio_write(tp, 0x15, 0x00c4);
12646 rtl8168_mdio_write(tp, 0x19, 0x00e6);
12647 rtl8168_mdio_write(tp, 0x15, 0x00c5);
12648 rtl8168_mdio_write(tp, 0x19, 0xdaec);
12649 rtl8168_mdio_write(tp, 0x15, 0x00c6);
12650 rtl8168_mdio_write(tp, 0x19, 0x00fa);
12651 rtl8168_mdio_write(tp, 0x15, 0x00c7);
12652 rtl8168_mdio_write(tp, 0x19, 0x9df9);
12653 rtl8168_mdio_write(tp, 0x15, 0x0112);
12654 rtl8168_mdio_write(tp, 0x19, 0x6421);
12655 rtl8168_mdio_write(tp, 0x15, 0x0113);
12656 rtl8168_mdio_write(tp, 0x19, 0x7c08);
12657 rtl8168_mdio_write(tp, 0x15, 0x0114);
12658 rtl8168_mdio_write(tp, 0x19, 0x63f0);
12659 rtl8168_mdio_write(tp, 0x15, 0x0115);
12660 rtl8168_mdio_write(tp, 0x19, 0x4003);
12661 rtl8168_mdio_write(tp, 0x15, 0x0116);
12662 rtl8168_mdio_write(tp, 0x19, 0x4418);
12663 rtl8168_mdio_write(tp, 0x15, 0x0117);
12664 rtl8168_mdio_write(tp, 0x19, 0x9b00);
12665 rtl8168_mdio_write(tp, 0x15, 0x0118);
12666 rtl8168_mdio_write(tp, 0x19, 0x6461);
12667 rtl8168_mdio_write(tp, 0x15, 0x0119);
12668 rtl8168_mdio_write(tp, 0x19, 0x64e1);
12669 rtl8168_mdio_write(tp, 0x15, 0x011a);
12670 rtl8168_mdio_write(tp, 0x19, 0x0000);
12671 rtl8168_mdio_write(tp, 0x15, 0x0150);
12672 rtl8168_mdio_write(tp, 0x19, 0x7c80);
12673 rtl8168_mdio_write(tp, 0x15, 0x0151);
12674 rtl8168_mdio_write(tp, 0x19, 0x6461);
12675 rtl8168_mdio_write(tp, 0x15, 0x0152);
12676 rtl8168_mdio_write(tp, 0x19, 0x4003);
12677 rtl8168_mdio_write(tp, 0x15, 0x0153);
12678 rtl8168_mdio_write(tp, 0x19, 0x4540);
12679 rtl8168_mdio_write(tp, 0x15, 0x0154);
12680 rtl8168_mdio_write(tp, 0x19, 0x9f00);
12681 rtl8168_mdio_write(tp, 0x15, 0x0155);
12682 rtl8168_mdio_write(tp, 0x19, 0x9d00);
12683 rtl8168_mdio_write(tp, 0x15, 0x0156);
12684 rtl8168_mdio_write(tp, 0x19, 0x7c40);
12685 rtl8168_mdio_write(tp, 0x15, 0x0157);
12686 rtl8168_mdio_write(tp, 0x19, 0x6421);
12687 rtl8168_mdio_write(tp, 0x15, 0x0158);
12688 rtl8168_mdio_write(tp, 0x19, 0x7c80);
12689 rtl8168_mdio_write(tp, 0x15, 0x0159);
12690 rtl8168_mdio_write(tp, 0x19, 0x64a1);
12691 rtl8168_mdio_write(tp, 0x15, 0x015a);
12692 rtl8168_mdio_write(tp, 0x19, 0x30fe);
12693 rtl8168_mdio_write(tp, 0x15, 0x029c);
12694 rtl8168_mdio_write(tp, 0x19, 0x0070);
12695 rtl8168_mdio_write(tp, 0x15, 0x02b2);
12696 rtl8168_mdio_write(tp, 0x19, 0x005a);
12697 rtl8168_mdio_write(tp, 0x15, 0x02bd);
12698 rtl8168_mdio_write(tp, 0x19, 0xa522);
12699 rtl8168_mdio_write(tp, 0x15, 0x02ce);
12700 rtl8168_mdio_write(tp, 0x19, 0xb63e);
12701 rtl8168_mdio_write(tp, 0x15, 0x02d9);
12702 rtl8168_mdio_write(tp, 0x19, 0x32df);
12703 rtl8168_mdio_write(tp, 0x15, 0x02df);
12704 rtl8168_mdio_write(tp, 0x19, 0x4500);
12705 rtl8168_mdio_write(tp, 0x15, 0x02f4);
12706 rtl8168_mdio_write(tp, 0x19, 0xb618);
12707 rtl8168_mdio_write(tp, 0x15, 0x02fb);
12708 rtl8168_mdio_write(tp, 0x19, 0xb900);
12709 rtl8168_mdio_write(tp, 0x15, 0x02fc);
12710 rtl8168_mdio_write(tp, 0x19, 0x49b5);
12711 rtl8168_mdio_write(tp, 0x15, 0x02fd);
12712 rtl8168_mdio_write(tp, 0x19, 0x6812);
12713 rtl8168_mdio_write(tp, 0x15, 0x02fe);
12714 rtl8168_mdio_write(tp, 0x19, 0x66a0);
12715 rtl8168_mdio_write(tp, 0x15, 0x02ff);
12716 rtl8168_mdio_write(tp, 0x19, 0x9900);
12717 rtl8168_mdio_write(tp, 0x15, 0x0300);
12718 rtl8168_mdio_write(tp, 0x19, 0x64a0);
12719 rtl8168_mdio_write(tp, 0x15, 0x0301);
12720 rtl8168_mdio_write(tp, 0x19, 0x3316);
12721 rtl8168_mdio_write(tp, 0x15, 0x0308);
12722 rtl8168_mdio_write(tp, 0x19, 0x0000);
12723 rtl8168_mdio_write(tp, 0x15, 0x030c);
12724 rtl8168_mdio_write(tp, 0x19, 0x3000);
12725 rtl8168_mdio_write(tp, 0x15, 0x0312);
12726 rtl8168_mdio_write(tp, 0x19, 0x0000);
12727 rtl8168_mdio_write(tp, 0x15, 0x0313);
12728 rtl8168_mdio_write(tp, 0x19, 0x0000);
12729 rtl8168_mdio_write(tp, 0x15, 0x0314);
12730 rtl8168_mdio_write(tp, 0x19, 0x0000);
12731 rtl8168_mdio_write(tp, 0x15, 0x0315);
12732 rtl8168_mdio_write(tp, 0x19, 0x0000);
12733 rtl8168_mdio_write(tp, 0x15, 0x0316);
12734 rtl8168_mdio_write(tp, 0x19, 0x49b5);
12735 rtl8168_mdio_write(tp, 0x15, 0x0317);
12736 rtl8168_mdio_write(tp, 0x19, 0x7d00);
12737 rtl8168_mdio_write(tp, 0x15, 0x0318);
12738 rtl8168_mdio_write(tp, 0x19, 0x4d00);
12739 rtl8168_mdio_write(tp, 0x15, 0x0319);
12740 rtl8168_mdio_write(tp, 0x19, 0x6810);
12741 rtl8168_mdio_write(tp, 0x15, 0x031a);
12742 rtl8168_mdio_write(tp, 0x19, 0x6c08);
12743 rtl8168_mdio_write(tp, 0x15, 0x031b);
12744 rtl8168_mdio_write(tp, 0x19, 0x4925);
12745 rtl8168_mdio_write(tp, 0x15, 0x031c);
12746 rtl8168_mdio_write(tp, 0x19, 0x403b);
12747 rtl8168_mdio_write(tp, 0x15, 0x031d);
12748 rtl8168_mdio_write(tp, 0x19, 0xa602);
12749 rtl8168_mdio_write(tp, 0x15, 0x031e);
12750 rtl8168_mdio_write(tp, 0x19, 0x402f);
12751 rtl8168_mdio_write(tp, 0x15, 0x031f);
12752 rtl8168_mdio_write(tp, 0x19, 0x4484);
12753 rtl8168_mdio_write(tp, 0x15, 0x0320);
12754 rtl8168_mdio_write(tp, 0x19, 0x40c8);
12755 rtl8168_mdio_write(tp, 0x15, 0x0321);
12756 rtl8168_mdio_write(tp, 0x19, 0x44c4);
12757 rtl8168_mdio_write(tp, 0x15, 0x0322);
12758 rtl8168_mdio_write(tp, 0x19, 0x404f);
12759 rtl8168_mdio_write(tp, 0x15, 0x0323);
12760 rtl8168_mdio_write(tp, 0x19, 0x44c8);
12761 rtl8168_mdio_write(tp, 0x15, 0x0324);
12762 rtl8168_mdio_write(tp, 0x19, 0xd64f);
12763 rtl8168_mdio_write(tp, 0x15, 0x0325);
12764 rtl8168_mdio_write(tp, 0x19, 0x00e7);
12765 rtl8168_mdio_write(tp, 0x15, 0x0326);
12766 rtl8168_mdio_write(tp, 0x19, 0x7c08);
12767 rtl8168_mdio_write(tp, 0x15, 0x0327);
12768 rtl8168_mdio_write(tp, 0x19, 0x8203);
12769 rtl8168_mdio_write(tp, 0x15, 0x0328);
12770 rtl8168_mdio_write(tp, 0x19, 0x4d48);
12771 rtl8168_mdio_write(tp, 0x15, 0x0329);
12772 rtl8168_mdio_write(tp, 0x19, 0x332b);
12773 rtl8168_mdio_write(tp, 0x15, 0x032a);
12774 rtl8168_mdio_write(tp, 0x19, 0x4d40);
12775 rtl8168_mdio_write(tp, 0x15, 0x032c);
12776 rtl8168_mdio_write(tp, 0x19, 0x00f8);
12777 rtl8168_mdio_write(tp, 0x15, 0x032d);
12778 rtl8168_mdio_write(tp, 0x19, 0x82b2);
12779 rtl8168_mdio_write(tp, 0x15, 0x032f);
12780 rtl8168_mdio_write(tp, 0x19, 0x00b0);
12781 rtl8168_mdio_write(tp, 0x15, 0x0332);
12782 rtl8168_mdio_write(tp, 0x19, 0x91f2);
12783 rtl8168_mdio_write(tp, 0x15, 0x033f);
12784 rtl8168_mdio_write(tp, 0x19, 0xb6cd);
12785 rtl8168_mdio_write(tp, 0x15, 0x0340);
12786 rtl8168_mdio_write(tp, 0x19, 0x9e01);
12787 rtl8168_mdio_write(tp, 0x15, 0x0341);
12788 rtl8168_mdio_write(tp, 0x19, 0xd11d);
12789 rtl8168_mdio_write(tp, 0x15, 0x0342);
12790 rtl8168_mdio_write(tp, 0x19, 0x009d);
12791 rtl8168_mdio_write(tp, 0x15, 0x0343);
12792 rtl8168_mdio_write(tp, 0x19, 0xbb1c);
12793 rtl8168_mdio_write(tp, 0x15, 0x0344);
12794 rtl8168_mdio_write(tp, 0x19, 0x8102);
12795 rtl8168_mdio_write(tp, 0x15, 0x0345);
12796 rtl8168_mdio_write(tp, 0x19, 0x3348);
12797 rtl8168_mdio_write(tp, 0x15, 0x0346);
12798 rtl8168_mdio_write(tp, 0x19, 0xa231);
12799 rtl8168_mdio_write(tp, 0x15, 0x0347);
12800 rtl8168_mdio_write(tp, 0x19, 0x335b);
12801 rtl8168_mdio_write(tp, 0x15, 0x0348);
12802 rtl8168_mdio_write(tp, 0x19, 0x91f7);
12803 rtl8168_mdio_write(tp, 0x15, 0x0349);
12804 rtl8168_mdio_write(tp, 0x19, 0xc218);
12805 rtl8168_mdio_write(tp, 0x15, 0x034a);
12806 rtl8168_mdio_write(tp, 0x19, 0x00f5);
12807 rtl8168_mdio_write(tp, 0x15, 0x034b);
12808 rtl8168_mdio_write(tp, 0x19, 0x335b);
12809 rtl8168_mdio_write(tp, 0x15, 0x034c);
12810 rtl8168_mdio_write(tp, 0x19, 0x0000);
12811 rtl8168_mdio_write(tp, 0x15, 0x034d);
12812 rtl8168_mdio_write(tp, 0x19, 0x0000);
12813 rtl8168_mdio_write(tp, 0x15, 0x034e);
12814 rtl8168_mdio_write(tp, 0x19, 0x0000);
12815 rtl8168_mdio_write(tp, 0x15, 0x034f);
12816 rtl8168_mdio_write(tp, 0x19, 0x0000);
12817 rtl8168_mdio_write(tp, 0x15, 0x0350);
12818 rtl8168_mdio_write(tp, 0x19, 0x0000);
12819 rtl8168_mdio_write(tp, 0x15, 0x035b);
12820 rtl8168_mdio_write(tp, 0x19, 0xa23c);
12821 rtl8168_mdio_write(tp, 0x15, 0x035c);
12822 rtl8168_mdio_write(tp, 0x19, 0x7c08);
12823 rtl8168_mdio_write(tp, 0x15, 0x035d);
12824 rtl8168_mdio_write(tp, 0x19, 0x4c00);
12825 rtl8168_mdio_write(tp, 0x15, 0x035e);
12826 rtl8168_mdio_write(tp, 0x19, 0x3397);
12827 rtl8168_mdio_write(tp, 0x15, 0x0363);
12828 rtl8168_mdio_write(tp, 0x19, 0xb6a9);
12829 rtl8168_mdio_write(tp, 0x15, 0x0366);
12830 rtl8168_mdio_write(tp, 0x19, 0x00f5);
12831 rtl8168_mdio_write(tp, 0x15, 0x0382);
12832 rtl8168_mdio_write(tp, 0x19, 0x7c40);
12833 rtl8168_mdio_write(tp, 0x15, 0x0388);
12834 rtl8168_mdio_write(tp, 0x19, 0x0084);
12835 rtl8168_mdio_write(tp, 0x15, 0x0389);
12836 rtl8168_mdio_write(tp, 0x19, 0xdd17);
12837 rtl8168_mdio_write(tp, 0x15, 0x038a);
12838 rtl8168_mdio_write(tp, 0x19, 0x000b);
12839 rtl8168_mdio_write(tp, 0x15, 0x038b);
12840 rtl8168_mdio_write(tp, 0x19, 0xa10a);
12841 rtl8168_mdio_write(tp, 0x15, 0x038c);
12842 rtl8168_mdio_write(tp, 0x19, 0x337e);
12843 rtl8168_mdio_write(tp, 0x15, 0x038d);
12844 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
12845 rtl8168_mdio_write(tp, 0x15, 0x038e);
12846 rtl8168_mdio_write(tp, 0x19, 0xa107);
12847 rtl8168_mdio_write(tp, 0x15, 0x038f);
12848 rtl8168_mdio_write(tp, 0x19, 0x6c08);
12849 rtl8168_mdio_write(tp, 0x15, 0x0390);
12850 rtl8168_mdio_write(tp, 0x19, 0xc017);
12851 rtl8168_mdio_write(tp, 0x15, 0x0391);
12852 rtl8168_mdio_write(tp, 0x19, 0x0004);
12853 rtl8168_mdio_write(tp, 0x15, 0x0392);
12854 rtl8168_mdio_write(tp, 0x19, 0xd64f);
12855 rtl8168_mdio_write(tp, 0x15, 0x0393);
12856 rtl8168_mdio_write(tp, 0x19, 0x00f4);
12857 rtl8168_mdio_write(tp, 0x15, 0x0397);
12858 rtl8168_mdio_write(tp, 0x19, 0x4098);
12859 rtl8168_mdio_write(tp, 0x15, 0x0398);
12860 rtl8168_mdio_write(tp, 0x19, 0x4408);
12861 rtl8168_mdio_write(tp, 0x15, 0x0399);
12862 rtl8168_mdio_write(tp, 0x19, 0x55bf);
12863 rtl8168_mdio_write(tp, 0x15, 0x039a);
12864 rtl8168_mdio_write(tp, 0x19, 0x4bb9);
12865 rtl8168_mdio_write(tp, 0x15, 0x039b);
12866 rtl8168_mdio_write(tp, 0x19, 0x6810);
12867 rtl8168_mdio_write(tp, 0x15, 0x039c);
12868 rtl8168_mdio_write(tp, 0x19, 0x4b29);
12869 rtl8168_mdio_write(tp, 0x15, 0x039d);
12870 rtl8168_mdio_write(tp, 0x19, 0x4041);
12871 rtl8168_mdio_write(tp, 0x15, 0x039e);
12872 rtl8168_mdio_write(tp, 0x19, 0x442a);
12873 rtl8168_mdio_write(tp, 0x15, 0x039f);
12874 rtl8168_mdio_write(tp, 0x19, 0x4029);
12875 rtl8168_mdio_write(tp, 0x15, 0x03aa);
12876 rtl8168_mdio_write(tp, 0x19, 0x33b8);
12877 rtl8168_mdio_write(tp, 0x15, 0x03b6);
12878 rtl8168_mdio_write(tp, 0x19, 0x0000);
12879 rtl8168_mdio_write(tp, 0x15, 0x03b7);
12880 rtl8168_mdio_write(tp, 0x19, 0x0000);
12881 rtl8168_mdio_write(tp, 0x15, 0x03b8);
12882 rtl8168_mdio_write(tp, 0x19, 0x543f);
12883 rtl8168_mdio_write(tp, 0x15, 0x03b9);
12884 rtl8168_mdio_write(tp, 0x19, 0x499a);
12885 rtl8168_mdio_write(tp, 0x15, 0x03ba);
12886 rtl8168_mdio_write(tp, 0x19, 0x7c40);
12887 rtl8168_mdio_write(tp, 0x15, 0x03bb);
12888 rtl8168_mdio_write(tp, 0x19, 0x4c40);
12889 rtl8168_mdio_write(tp, 0x15, 0x03bc);
12890 rtl8168_mdio_write(tp, 0x19, 0x490a);
12891 rtl8168_mdio_write(tp, 0x15, 0x03bd);
12892 rtl8168_mdio_write(tp, 0x19, 0x405e);
12893 rtl8168_mdio_write(tp, 0x15, 0x03c2);
12894 rtl8168_mdio_write(tp, 0x19, 0x9a03);
12895 rtl8168_mdio_write(tp, 0x15, 0x03c4);
12896 rtl8168_mdio_write(tp, 0x19, 0x0015);
12897 rtl8168_mdio_write(tp, 0x15, 0x03c5);
12898 rtl8168_mdio_write(tp, 0x19, 0x9e03);
12899 rtl8168_mdio_write(tp, 0x15, 0x03c8);
12900 rtl8168_mdio_write(tp, 0x19, 0x9cf7);
12901 rtl8168_mdio_write(tp, 0x15, 0x03c9);
12902 rtl8168_mdio_write(tp, 0x19, 0x7c12);
12903 rtl8168_mdio_write(tp, 0x15, 0x03ca);
12904 rtl8168_mdio_write(tp, 0x19, 0x4c52);
12905 rtl8168_mdio_write(tp, 0x15, 0x03cb);
12906 rtl8168_mdio_write(tp, 0x19, 0x4458);
12907 rtl8168_mdio_write(tp, 0x15, 0x03cd);
12908 rtl8168_mdio_write(tp, 0x19, 0x4c40);
12909 rtl8168_mdio_write(tp, 0x15, 0x03ce);
12910 rtl8168_mdio_write(tp, 0x19, 0x33bf);
12911 rtl8168_mdio_write(tp, 0x15, 0x03cf);
12912 rtl8168_mdio_write(tp, 0x19, 0x0000);
12913 rtl8168_mdio_write(tp, 0x15, 0x03d0);
12914 rtl8168_mdio_write(tp, 0x19, 0x0000);
12915 rtl8168_mdio_write(tp, 0x15, 0x03d1);
12916 rtl8168_mdio_write(tp, 0x19, 0x0000);
12917 rtl8168_mdio_write(tp, 0x15, 0x03d5);
12918 rtl8168_mdio_write(tp, 0x19, 0x0000);
12919 rtl8168_mdio_write(tp, 0x15, 0x03d6);
12920 rtl8168_mdio_write(tp, 0x19, 0x0000);
12921 rtl8168_mdio_write(tp, 0x15, 0x03d7);
12922 rtl8168_mdio_write(tp, 0x19, 0x0000);
12923 rtl8168_mdio_write(tp, 0x15, 0x03d8);
12924 rtl8168_mdio_write(tp, 0x19, 0x0000);
12925 rtl8168_mdio_write(tp, 0x15, 0x03d9);
12926 rtl8168_mdio_write(tp, 0x19, 0x49bb);
12927 rtl8168_mdio_write(tp, 0x15, 0x03da);
12928 rtl8168_mdio_write(tp, 0x19, 0x4478);
12929 rtl8168_mdio_write(tp, 0x15, 0x03db);
12930 rtl8168_mdio_write(tp, 0x19, 0x492b);
12931 rtl8168_mdio_write(tp, 0x15, 0x03dc);
12932 rtl8168_mdio_write(tp, 0x19, 0x7c01);
12933 rtl8168_mdio_write(tp, 0x15, 0x03dd);
12934 rtl8168_mdio_write(tp, 0x19, 0x4c00);
12935 rtl8168_mdio_write(tp, 0x15, 0x03de);
12936 rtl8168_mdio_write(tp, 0x19, 0xbd1a);
12937 rtl8168_mdio_write(tp, 0x15, 0x03df);
12938 rtl8168_mdio_write(tp, 0x19, 0xc428);
12939 rtl8168_mdio_write(tp, 0x15, 0x03e0);
12940 rtl8168_mdio_write(tp, 0x19, 0x0008);
12941 rtl8168_mdio_write(tp, 0x15, 0x03e1);
12942 rtl8168_mdio_write(tp, 0x19, 0x9cfd);
12943 rtl8168_mdio_write(tp, 0x15, 0x03e2);
12944 rtl8168_mdio_write(tp, 0x19, 0x7c12);
12945 rtl8168_mdio_write(tp, 0x15, 0x03e3);
12946 rtl8168_mdio_write(tp, 0x19, 0x4c52);
12947 rtl8168_mdio_write(tp, 0x15, 0x03e4);
12948 rtl8168_mdio_write(tp, 0x19, 0x4458);
12949 rtl8168_mdio_write(tp, 0x15, 0x03e5);
12950 rtl8168_mdio_write(tp, 0x19, 0x7c12);
12951 rtl8168_mdio_write(tp, 0x15, 0x03e6);
12952 rtl8168_mdio_write(tp, 0x19, 0x4c40);
12953 rtl8168_mdio_write(tp, 0x15, 0x03e7);
12954 rtl8168_mdio_write(tp, 0x19, 0x33de);
12955 rtl8168_mdio_write(tp, 0x15, 0x03e8);
12956 rtl8168_mdio_write(tp, 0x19, 0xc218);
12957 rtl8168_mdio_write(tp, 0x15, 0x03e9);
12958 rtl8168_mdio_write(tp, 0x19, 0x0002);
12959 rtl8168_mdio_write(tp, 0x15, 0x03ea);
12960 rtl8168_mdio_write(tp, 0x19, 0x32df);
12961 rtl8168_mdio_write(tp, 0x15, 0x03eb);
12962 rtl8168_mdio_write(tp, 0x19, 0x3316);
12963 rtl8168_mdio_write(tp, 0x15, 0x03ec);
12964 rtl8168_mdio_write(tp, 0x19, 0x0000);
12965 rtl8168_mdio_write(tp, 0x15, 0x03ed);
12966 rtl8168_mdio_write(tp, 0x19, 0x0000);
12967 rtl8168_mdio_write(tp, 0x15, 0x03ee);
12968 rtl8168_mdio_write(tp, 0x19, 0x0000);
12969 rtl8168_mdio_write(tp, 0x15, 0x03ef);
12970 rtl8168_mdio_write(tp, 0x19, 0x0000);
12971 rtl8168_mdio_write(tp, 0x15, 0x03f7);
12972 rtl8168_mdio_write(tp, 0x19, 0x330c);
12973 rtl8168_mdio_write(tp, 0x16, 0x0306);
12974 rtl8168_mdio_write(tp, 0x16, 0x0300);
12975
12976 rtl8168_mdio_write(tp, 0x1f, 0x0005);
12977 rtl8168_mdio_write(tp, 0x05, 0xfff6);
12978 rtl8168_mdio_write(tp, 0x06, 0x0080);
12979 rtl8168_mdio_write(tp, 0x05, 0x8000);
12980 rtl8168_mdio_write(tp, 0x06, 0x0280);
12981 rtl8168_mdio_write(tp, 0x06, 0x48f7);
12982 rtl8168_mdio_write(tp, 0x06, 0x00e0);
12983 rtl8168_mdio_write(tp, 0x06, 0xfff7);
12984 rtl8168_mdio_write(tp, 0x06, 0xa080);
12985 rtl8168_mdio_write(tp, 0x06, 0x02ae);
12986 rtl8168_mdio_write(tp, 0x06, 0xf602);
12987 rtl8168_mdio_write(tp, 0x06, 0x0200);
12988 rtl8168_mdio_write(tp, 0x06, 0x0280);
12989 rtl8168_mdio_write(tp, 0x06, 0x9002);
12990 rtl8168_mdio_write(tp, 0x06, 0x0224);
12991 rtl8168_mdio_write(tp, 0x06, 0x0202);
12992 rtl8168_mdio_write(tp, 0x06, 0x3402);
12993 rtl8168_mdio_write(tp, 0x06, 0x027f);
12994 rtl8168_mdio_write(tp, 0x06, 0x0280);
12995 rtl8168_mdio_write(tp, 0x06, 0xa602);
12996 rtl8168_mdio_write(tp, 0x06, 0x80bf);
12997 rtl8168_mdio_write(tp, 0x06, 0xe08b);
12998 rtl8168_mdio_write(tp, 0x06, 0x88e1);
12999 rtl8168_mdio_write(tp, 0x06, 0x8b89);
13000 rtl8168_mdio_write(tp, 0x06, 0x1e01);
13001 rtl8168_mdio_write(tp, 0x06, 0xe18b);
13002 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
13003 rtl8168_mdio_write(tp, 0x06, 0x01e1);
13004 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
13005 rtl8168_mdio_write(tp, 0x06, 0x1e01);
13006 rtl8168_mdio_write(tp, 0x06, 0xe18b);
13007 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
13008 rtl8168_mdio_write(tp, 0x06, 0x01e1);
13009 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
13010 rtl8168_mdio_write(tp, 0x06, 0x1e01);
13011 rtl8168_mdio_write(tp, 0x06, 0xe18b);
13012 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
13013 rtl8168_mdio_write(tp, 0x06, 0x01a0);
13014 rtl8168_mdio_write(tp, 0x06, 0x00c7);
13015 rtl8168_mdio_write(tp, 0x06, 0xaebb);
13016 rtl8168_mdio_write(tp, 0x06, 0xee8a);
13017 rtl8168_mdio_write(tp, 0x06, 0xe600);
13018 rtl8168_mdio_write(tp, 0x06, 0xee8a);
13019 rtl8168_mdio_write(tp, 0x06, 0xee03);
13020 rtl8168_mdio_write(tp, 0x06, 0xee8a);
13021 rtl8168_mdio_write(tp, 0x06, 0xefb8);
13022 rtl8168_mdio_write(tp, 0x06, 0xee8a);
13023 rtl8168_mdio_write(tp, 0x06, 0xe902);
13024 rtl8168_mdio_write(tp, 0x06, 0xee8b);
13025 rtl8168_mdio_write(tp, 0x06, 0x8285);
13026 rtl8168_mdio_write(tp, 0x06, 0xee8b);
13027 rtl8168_mdio_write(tp, 0x06, 0x8520);
13028 rtl8168_mdio_write(tp, 0x06, 0xee8b);
13029 rtl8168_mdio_write(tp, 0x06, 0x8701);
13030 rtl8168_mdio_write(tp, 0x06, 0xd481);
13031 rtl8168_mdio_write(tp, 0x06, 0x35e4);
13032 rtl8168_mdio_write(tp, 0x06, 0x8b94);
13033 rtl8168_mdio_write(tp, 0x06, 0xe58b);
13034 rtl8168_mdio_write(tp, 0x06, 0x95bf);
13035 rtl8168_mdio_write(tp, 0x06, 0x8b88);
13036 rtl8168_mdio_write(tp, 0x06, 0xec00);
13037 rtl8168_mdio_write(tp, 0x06, 0x19a9);
13038 rtl8168_mdio_write(tp, 0x06, 0x8b90);
13039 rtl8168_mdio_write(tp, 0x06, 0xf9ee);
13040 rtl8168_mdio_write(tp, 0x06, 0xfff6);
13041 rtl8168_mdio_write(tp, 0x06, 0x00ee);
13042 rtl8168_mdio_write(tp, 0x06, 0xfff7);
13043 rtl8168_mdio_write(tp, 0x06, 0xffe0);
13044 rtl8168_mdio_write(tp, 0x06, 0xe140);
13045 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
13046 rtl8168_mdio_write(tp, 0x06, 0x41f7);
13047 rtl8168_mdio_write(tp, 0x06, 0x2ff6);
13048 rtl8168_mdio_write(tp, 0x06, 0x28e4);
13049 rtl8168_mdio_write(tp, 0x06, 0xe140);
13050 rtl8168_mdio_write(tp, 0x06, 0xe5e1);
13051 rtl8168_mdio_write(tp, 0x06, 0x4104);
13052 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
13053 rtl8168_mdio_write(tp, 0x06, 0x8b89);
13054 rtl8168_mdio_write(tp, 0x06, 0xad20);
13055 rtl8168_mdio_write(tp, 0x06, 0x0dee);
13056 rtl8168_mdio_write(tp, 0x06, 0x8b89);
13057 rtl8168_mdio_write(tp, 0x06, 0x0002);
13058 rtl8168_mdio_write(tp, 0x06, 0x82f4);
13059 rtl8168_mdio_write(tp, 0x06, 0x021f);
13060 rtl8168_mdio_write(tp, 0x06, 0x4102);
13061 rtl8168_mdio_write(tp, 0x06, 0x2812);
13062 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13063 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
13064 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
13065 rtl8168_mdio_write(tp, 0x06, 0xad20);
13066 rtl8168_mdio_write(tp, 0x06, 0x10ee);
13067 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
13068 rtl8168_mdio_write(tp, 0x06, 0x0002);
13069 rtl8168_mdio_write(tp, 0x06, 0x139d);
13070 rtl8168_mdio_write(tp, 0x06, 0x0281);
13071 rtl8168_mdio_write(tp, 0x06, 0xd602);
13072 rtl8168_mdio_write(tp, 0x06, 0x1f99);
13073 rtl8168_mdio_write(tp, 0x06, 0x0227);
13074 rtl8168_mdio_write(tp, 0x06, 0xeafc);
13075 rtl8168_mdio_write(tp, 0x06, 0x04f8);
13076 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13077 rtl8168_mdio_write(tp, 0x06, 0x8ead);
13078 rtl8168_mdio_write(tp, 0x06, 0x2014);
13079 rtl8168_mdio_write(tp, 0x06, 0xf620);
13080 rtl8168_mdio_write(tp, 0x06, 0xe48b);
13081 rtl8168_mdio_write(tp, 0x06, 0x8e02);
13082 rtl8168_mdio_write(tp, 0x06, 0x8104);
13083 rtl8168_mdio_write(tp, 0x06, 0x021b);
13084 rtl8168_mdio_write(tp, 0x06, 0xf402);
13085 rtl8168_mdio_write(tp, 0x06, 0x2c9c);
13086 rtl8168_mdio_write(tp, 0x06, 0x0281);
13087 rtl8168_mdio_write(tp, 0x06, 0x7902);
13088 rtl8168_mdio_write(tp, 0x06, 0x8443);
13089 rtl8168_mdio_write(tp, 0x06, 0xad22);
13090 rtl8168_mdio_write(tp, 0x06, 0x11f6);
13091 rtl8168_mdio_write(tp, 0x06, 0x22e4);
13092 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
13093 rtl8168_mdio_write(tp, 0x06, 0x022c);
13094 rtl8168_mdio_write(tp, 0x06, 0x4602);
13095 rtl8168_mdio_write(tp, 0x06, 0x2ac5);
13096 rtl8168_mdio_write(tp, 0x06, 0x0229);
13097 rtl8168_mdio_write(tp, 0x06, 0x2002);
13098 rtl8168_mdio_write(tp, 0x06, 0x2b91);
13099 rtl8168_mdio_write(tp, 0x06, 0xad25);
13100 rtl8168_mdio_write(tp, 0x06, 0x11f6);
13101 rtl8168_mdio_write(tp, 0x06, 0x25e4);
13102 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
13103 rtl8168_mdio_write(tp, 0x06, 0x0284);
13104 rtl8168_mdio_write(tp, 0x06, 0xe202);
13105 rtl8168_mdio_write(tp, 0x06, 0x043a);
13106 rtl8168_mdio_write(tp, 0x06, 0x021a);
13107 rtl8168_mdio_write(tp, 0x06, 0x5902);
13108 rtl8168_mdio_write(tp, 0x06, 0x2bfc);
13109 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13110 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
13111 rtl8168_mdio_write(tp, 0x06, 0xef69);
13112 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13113 rtl8168_mdio_write(tp, 0x06, 0x00e1);
13114 rtl8168_mdio_write(tp, 0x06, 0xe001);
13115 rtl8168_mdio_write(tp, 0x06, 0xad27);
13116 rtl8168_mdio_write(tp, 0x06, 0x1fd1);
13117 rtl8168_mdio_write(tp, 0x06, 0x01bf);
13118 rtl8168_mdio_write(tp, 0x06, 0x8638);
13119 rtl8168_mdio_write(tp, 0x06, 0x022f);
13120 rtl8168_mdio_write(tp, 0x06, 0x50e0);
13121 rtl8168_mdio_write(tp, 0x06, 0xe020);
13122 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13123 rtl8168_mdio_write(tp, 0x06, 0x21ad);
13124 rtl8168_mdio_write(tp, 0x06, 0x200e);
13125 rtl8168_mdio_write(tp, 0x06, 0xd100);
13126 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13127 rtl8168_mdio_write(tp, 0x06, 0x3802);
13128 rtl8168_mdio_write(tp, 0x06, 0x2f50);
13129 rtl8168_mdio_write(tp, 0x06, 0xbf3d);
13130 rtl8168_mdio_write(tp, 0x06, 0x3902);
13131 rtl8168_mdio_write(tp, 0x06, 0x2eb0);
13132 rtl8168_mdio_write(tp, 0x06, 0xef96);
13133 rtl8168_mdio_write(tp, 0x06, 0xfefc);
13134 rtl8168_mdio_write(tp, 0x06, 0x0402);
13135 rtl8168_mdio_write(tp, 0x06, 0x8591);
13136 rtl8168_mdio_write(tp, 0x06, 0x0281);
13137 rtl8168_mdio_write(tp, 0x06, 0x3c05);
13138 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
13139 rtl8168_mdio_write(tp, 0x06, 0xef69);
13140 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13141 rtl8168_mdio_write(tp, 0x06, 0xfee1);
13142 rtl8168_mdio_write(tp, 0x06, 0xe2ff);
13143 rtl8168_mdio_write(tp, 0x06, 0xad2d);
13144 rtl8168_mdio_write(tp, 0x06, 0x1ae0);
13145 rtl8168_mdio_write(tp, 0x06, 0xe14e);
13146 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
13147 rtl8168_mdio_write(tp, 0x06, 0x4fac);
13148 rtl8168_mdio_write(tp, 0x06, 0x2d22);
13149 rtl8168_mdio_write(tp, 0x06, 0xf603);
13150 rtl8168_mdio_write(tp, 0x06, 0x0203);
13151 rtl8168_mdio_write(tp, 0x06, 0x36f7);
13152 rtl8168_mdio_write(tp, 0x06, 0x03f7);
13153 rtl8168_mdio_write(tp, 0x06, 0x06bf);
13154 rtl8168_mdio_write(tp, 0x06, 0x8622);
13155 rtl8168_mdio_write(tp, 0x06, 0x022e);
13156 rtl8168_mdio_write(tp, 0x06, 0xb0ae);
13157 rtl8168_mdio_write(tp, 0x06, 0x11e0);
13158 rtl8168_mdio_write(tp, 0x06, 0xe14e);
13159 rtl8168_mdio_write(tp, 0x06, 0xe1e1);
13160 rtl8168_mdio_write(tp, 0x06, 0x4fad);
13161 rtl8168_mdio_write(tp, 0x06, 0x2d08);
13162 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13163 rtl8168_mdio_write(tp, 0x06, 0x2d02);
13164 rtl8168_mdio_write(tp, 0x06, 0x2eb0);
13165 rtl8168_mdio_write(tp, 0x06, 0xf606);
13166 rtl8168_mdio_write(tp, 0x06, 0xef96);
13167 rtl8168_mdio_write(tp, 0x06, 0xfefc);
13168 rtl8168_mdio_write(tp, 0x06, 0x04f8);
13169 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
13170 rtl8168_mdio_write(tp, 0x06, 0xef69);
13171 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13172 rtl8168_mdio_write(tp, 0x06, 0x87ad);
13173 rtl8168_mdio_write(tp, 0x06, 0x204c);
13174 rtl8168_mdio_write(tp, 0x06, 0xd200);
13175 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13176 rtl8168_mdio_write(tp, 0x06, 0x0058);
13177 rtl8168_mdio_write(tp, 0x06, 0x010c);
13178 rtl8168_mdio_write(tp, 0x06, 0x021e);
13179 rtl8168_mdio_write(tp, 0x06, 0x20e0);
13180 rtl8168_mdio_write(tp, 0x06, 0xe000);
13181 rtl8168_mdio_write(tp, 0x06, 0x5810);
13182 rtl8168_mdio_write(tp, 0x06, 0x1e20);
13183 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13184 rtl8168_mdio_write(tp, 0x06, 0x3658);
13185 rtl8168_mdio_write(tp, 0x06, 0x031e);
13186 rtl8168_mdio_write(tp, 0x06, 0x20e0);
13187 rtl8168_mdio_write(tp, 0x06, 0xe022);
13188 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13189 rtl8168_mdio_write(tp, 0x06, 0x2358);
13190 rtl8168_mdio_write(tp, 0x06, 0xe01e);
13191 rtl8168_mdio_write(tp, 0x06, 0x20e0);
13192 rtl8168_mdio_write(tp, 0x06, 0x8ae6);
13193 rtl8168_mdio_write(tp, 0x06, 0x1f02);
13194 rtl8168_mdio_write(tp, 0x06, 0x9e22);
13195 rtl8168_mdio_write(tp, 0x06, 0xe68a);
13196 rtl8168_mdio_write(tp, 0x06, 0xe6ad);
13197 rtl8168_mdio_write(tp, 0x06, 0x3214);
13198 rtl8168_mdio_write(tp, 0x06, 0xad34);
13199 rtl8168_mdio_write(tp, 0x06, 0x11ef);
13200 rtl8168_mdio_write(tp, 0x06, 0x0258);
13201 rtl8168_mdio_write(tp, 0x06, 0x039e);
13202 rtl8168_mdio_write(tp, 0x06, 0x07ad);
13203 rtl8168_mdio_write(tp, 0x06, 0x3508);
13204 rtl8168_mdio_write(tp, 0x06, 0x5ac0);
13205 rtl8168_mdio_write(tp, 0x06, 0x9f04);
13206 rtl8168_mdio_write(tp, 0x06, 0xd101);
13207 rtl8168_mdio_write(tp, 0x06, 0xae02);
13208 rtl8168_mdio_write(tp, 0x06, 0xd100);
13209 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13210 rtl8168_mdio_write(tp, 0x06, 0x3e02);
13211 rtl8168_mdio_write(tp, 0x06, 0x2f50);
13212 rtl8168_mdio_write(tp, 0x06, 0xef96);
13213 rtl8168_mdio_write(tp, 0x06, 0xfefd);
13214 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13215 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
13216 rtl8168_mdio_write(tp, 0x06, 0xfae0);
13217 rtl8168_mdio_write(tp, 0x06, 0x8b81);
13218 rtl8168_mdio_write(tp, 0x06, 0xac26);
13219 rtl8168_mdio_write(tp, 0x06, 0x0ee0);
13220 rtl8168_mdio_write(tp, 0x06, 0x8b81);
13221 rtl8168_mdio_write(tp, 0x06, 0xac21);
13222 rtl8168_mdio_write(tp, 0x06, 0x08e0);
13223 rtl8168_mdio_write(tp, 0x06, 0x8b87);
13224 rtl8168_mdio_write(tp, 0x06, 0xac24);
13225 rtl8168_mdio_write(tp, 0x06, 0x02ae);
13226 rtl8168_mdio_write(tp, 0x06, 0x6bee);
13227 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
13228 rtl8168_mdio_write(tp, 0x06, 0x00ee);
13229 rtl8168_mdio_write(tp, 0x06, 0xe0eb);
13230 rtl8168_mdio_write(tp, 0x06, 0x00e2);
13231 rtl8168_mdio_write(tp, 0x06, 0xe07c);
13232 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
13233 rtl8168_mdio_write(tp, 0x06, 0x7da5);
13234 rtl8168_mdio_write(tp, 0x06, 0x1111);
13235 rtl8168_mdio_write(tp, 0x06, 0x15d2);
13236 rtl8168_mdio_write(tp, 0x06, 0x60d6);
13237 rtl8168_mdio_write(tp, 0x06, 0x6666);
13238 rtl8168_mdio_write(tp, 0x06, 0x0207);
13239 rtl8168_mdio_write(tp, 0x06, 0xf9d2);
13240 rtl8168_mdio_write(tp, 0x06, 0xa0d6);
13241 rtl8168_mdio_write(tp, 0x06, 0xaaaa);
13242 rtl8168_mdio_write(tp, 0x06, 0x0207);
13243 rtl8168_mdio_write(tp, 0x06, 0xf902);
13244 rtl8168_mdio_write(tp, 0x06, 0x825c);
13245 rtl8168_mdio_write(tp, 0x06, 0xae44);
13246 rtl8168_mdio_write(tp, 0x06, 0xa566);
13247 rtl8168_mdio_write(tp, 0x06, 0x6602);
13248 rtl8168_mdio_write(tp, 0x06, 0xae38);
13249 rtl8168_mdio_write(tp, 0x06, 0xa5aa);
13250 rtl8168_mdio_write(tp, 0x06, 0xaa02);
13251 rtl8168_mdio_write(tp, 0x06, 0xae32);
13252 rtl8168_mdio_write(tp, 0x06, 0xeee0);
13253 rtl8168_mdio_write(tp, 0x06, 0xea04);
13254 rtl8168_mdio_write(tp, 0x06, 0xeee0);
13255 rtl8168_mdio_write(tp, 0x06, 0xeb06);
13256 rtl8168_mdio_write(tp, 0x06, 0xe2e0);
13257 rtl8168_mdio_write(tp, 0x06, 0x7ce3);
13258 rtl8168_mdio_write(tp, 0x06, 0xe07d);
13259 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13260 rtl8168_mdio_write(tp, 0x06, 0x38e1);
13261 rtl8168_mdio_write(tp, 0x06, 0xe039);
13262 rtl8168_mdio_write(tp, 0x06, 0xad2e);
13263 rtl8168_mdio_write(tp, 0x06, 0x21ad);
13264 rtl8168_mdio_write(tp, 0x06, 0x3f13);
13265 rtl8168_mdio_write(tp, 0x06, 0xe0e4);
13266 rtl8168_mdio_write(tp, 0x06, 0x14e1);
13267 rtl8168_mdio_write(tp, 0x06, 0xe415);
13268 rtl8168_mdio_write(tp, 0x06, 0x6880);
13269 rtl8168_mdio_write(tp, 0x06, 0xe4e4);
13270 rtl8168_mdio_write(tp, 0x06, 0x14e5);
13271 rtl8168_mdio_write(tp, 0x06, 0xe415);
13272 rtl8168_mdio_write(tp, 0x06, 0x0282);
13273 rtl8168_mdio_write(tp, 0x06, 0x5cae);
13274 rtl8168_mdio_write(tp, 0x06, 0x0bac);
13275 rtl8168_mdio_write(tp, 0x06, 0x3e02);
13276 rtl8168_mdio_write(tp, 0x06, 0xae06);
13277 rtl8168_mdio_write(tp, 0x06, 0x0282);
13278 rtl8168_mdio_write(tp, 0x06, 0x8602);
13279 rtl8168_mdio_write(tp, 0x06, 0x82b0);
13280 rtl8168_mdio_write(tp, 0x06, 0xfefd);
13281 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13282 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
13283 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
13284 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13285 rtl8168_mdio_write(tp, 0x06, 0x81ad);
13286 rtl8168_mdio_write(tp, 0x06, 0x2605);
13287 rtl8168_mdio_write(tp, 0x06, 0x0221);
13288 rtl8168_mdio_write(tp, 0x06, 0xf3f7);
13289 rtl8168_mdio_write(tp, 0x06, 0x28e0);
13290 rtl8168_mdio_write(tp, 0x06, 0x8b81);
13291 rtl8168_mdio_write(tp, 0x06, 0xad21);
13292 rtl8168_mdio_write(tp, 0x06, 0x0502);
13293 rtl8168_mdio_write(tp, 0x06, 0x22f8);
13294 rtl8168_mdio_write(tp, 0x06, 0xf729);
13295 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13296 rtl8168_mdio_write(tp, 0x06, 0x87ad);
13297 rtl8168_mdio_write(tp, 0x06, 0x2405);
13298 rtl8168_mdio_write(tp, 0x06, 0x0282);
13299 rtl8168_mdio_write(tp, 0x06, 0xebf7);
13300 rtl8168_mdio_write(tp, 0x06, 0x2ae5);
13301 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
13302 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13303 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
13304 rtl8168_mdio_write(tp, 0x06, 0x8b81);
13305 rtl8168_mdio_write(tp, 0x06, 0xad26);
13306 rtl8168_mdio_write(tp, 0x06, 0x0302);
13307 rtl8168_mdio_write(tp, 0x06, 0x2134);
13308 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13309 rtl8168_mdio_write(tp, 0x06, 0x81ad);
13310 rtl8168_mdio_write(tp, 0x06, 0x2109);
13311 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13312 rtl8168_mdio_write(tp, 0x06, 0x2eac);
13313 rtl8168_mdio_write(tp, 0x06, 0x2003);
13314 rtl8168_mdio_write(tp, 0x06, 0x0283);
13315 rtl8168_mdio_write(tp, 0x06, 0x52e0);
13316 rtl8168_mdio_write(tp, 0x06, 0x8b87);
13317 rtl8168_mdio_write(tp, 0x06, 0xad24);
13318 rtl8168_mdio_write(tp, 0x06, 0x09e0);
13319 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
13320 rtl8168_mdio_write(tp, 0x06, 0xac21);
13321 rtl8168_mdio_write(tp, 0x06, 0x0302);
13322 rtl8168_mdio_write(tp, 0x06, 0x8337);
13323 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13324 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
13325 rtl8168_mdio_write(tp, 0x06, 0x8b2e);
13326 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13327 rtl8168_mdio_write(tp, 0x06, 0x81ad);
13328 rtl8168_mdio_write(tp, 0x06, 0x2608);
13329 rtl8168_mdio_write(tp, 0x06, 0xe085);
13330 rtl8168_mdio_write(tp, 0x06, 0xd2ad);
13331 rtl8168_mdio_write(tp, 0x06, 0x2502);
13332 rtl8168_mdio_write(tp, 0x06, 0xf628);
13333 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13334 rtl8168_mdio_write(tp, 0x06, 0x81ad);
13335 rtl8168_mdio_write(tp, 0x06, 0x210a);
13336 rtl8168_mdio_write(tp, 0x06, 0xe086);
13337 rtl8168_mdio_write(tp, 0x06, 0x0af6);
13338 rtl8168_mdio_write(tp, 0x06, 0x27a0);
13339 rtl8168_mdio_write(tp, 0x06, 0x0502);
13340 rtl8168_mdio_write(tp, 0x06, 0xf629);
13341 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13342 rtl8168_mdio_write(tp, 0x06, 0x87ad);
13343 rtl8168_mdio_write(tp, 0x06, 0x2408);
13344 rtl8168_mdio_write(tp, 0x06, 0xe08a);
13345 rtl8168_mdio_write(tp, 0x06, 0xedad);
13346 rtl8168_mdio_write(tp, 0x06, 0x2002);
13347 rtl8168_mdio_write(tp, 0x06, 0xf62a);
13348 rtl8168_mdio_write(tp, 0x06, 0xe58b);
13349 rtl8168_mdio_write(tp, 0x06, 0x2ea1);
13350 rtl8168_mdio_write(tp, 0x06, 0x0003);
13351 rtl8168_mdio_write(tp, 0x06, 0x0221);
13352 rtl8168_mdio_write(tp, 0x06, 0x11fc);
13353 rtl8168_mdio_write(tp, 0x06, 0x04ee);
13354 rtl8168_mdio_write(tp, 0x06, 0x8aed);
13355 rtl8168_mdio_write(tp, 0x06, 0x00ee);
13356 rtl8168_mdio_write(tp, 0x06, 0x8aec);
13357 rtl8168_mdio_write(tp, 0x06, 0x0004);
13358 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
13359 rtl8168_mdio_write(tp, 0x06, 0x8b87);
13360 rtl8168_mdio_write(tp, 0x06, 0xad24);
13361 rtl8168_mdio_write(tp, 0x06, 0x3ae0);
13362 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
13363 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13364 rtl8168_mdio_write(tp, 0x06, 0xeb58);
13365 rtl8168_mdio_write(tp, 0x06, 0xf8d1);
13366 rtl8168_mdio_write(tp, 0x06, 0x01e4);
13367 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
13368 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
13369 rtl8168_mdio_write(tp, 0x06, 0xebe0);
13370 rtl8168_mdio_write(tp, 0x06, 0xe07c);
13371 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13372 rtl8168_mdio_write(tp, 0x06, 0x7d5c);
13373 rtl8168_mdio_write(tp, 0x06, 0x00ff);
13374 rtl8168_mdio_write(tp, 0x06, 0x3c00);
13375 rtl8168_mdio_write(tp, 0x06, 0x1eab);
13376 rtl8168_mdio_write(tp, 0x06, 0x1ce0);
13377 rtl8168_mdio_write(tp, 0x06, 0xe04c);
13378 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13379 rtl8168_mdio_write(tp, 0x06, 0x4d58);
13380 rtl8168_mdio_write(tp, 0x06, 0xc1e4);
13381 rtl8168_mdio_write(tp, 0x06, 0xe04c);
13382 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
13383 rtl8168_mdio_write(tp, 0x06, 0x4de0);
13384 rtl8168_mdio_write(tp, 0x06, 0xe0ee);
13385 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13386 rtl8168_mdio_write(tp, 0x06, 0xef69);
13387 rtl8168_mdio_write(tp, 0x06, 0x3ce4);
13388 rtl8168_mdio_write(tp, 0x06, 0xe0ee);
13389 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
13390 rtl8168_mdio_write(tp, 0x06, 0xeffc);
13391 rtl8168_mdio_write(tp, 0x06, 0x04f8);
13392 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13393 rtl8168_mdio_write(tp, 0x06, 0x87ad);
13394 rtl8168_mdio_write(tp, 0x06, 0x2412);
13395 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13396 rtl8168_mdio_write(tp, 0x06, 0xeee1);
13397 rtl8168_mdio_write(tp, 0x06, 0xe0ef);
13398 rtl8168_mdio_write(tp, 0x06, 0x59c3);
13399 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
13400 rtl8168_mdio_write(tp, 0x06, 0xeee5);
13401 rtl8168_mdio_write(tp, 0x06, 0xe0ef);
13402 rtl8168_mdio_write(tp, 0x06, 0xee8a);
13403 rtl8168_mdio_write(tp, 0x06, 0xed01);
13404 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13405 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
13406 rtl8168_mdio_write(tp, 0x06, 0x8b81);
13407 rtl8168_mdio_write(tp, 0x06, 0xac25);
13408 rtl8168_mdio_write(tp, 0x06, 0x0502);
13409 rtl8168_mdio_write(tp, 0x06, 0x8363);
13410 rtl8168_mdio_write(tp, 0x06, 0xae03);
13411 rtl8168_mdio_write(tp, 0x06, 0x0225);
13412 rtl8168_mdio_write(tp, 0x06, 0x16fc);
13413 rtl8168_mdio_write(tp, 0x06, 0x04f8);
13414 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
13415 rtl8168_mdio_write(tp, 0x06, 0xef69);
13416 rtl8168_mdio_write(tp, 0x06, 0xfae0);
13417 rtl8168_mdio_write(tp, 0x06, 0x860a);
13418 rtl8168_mdio_write(tp, 0x06, 0xa000);
13419 rtl8168_mdio_write(tp, 0x06, 0x19e0);
13420 rtl8168_mdio_write(tp, 0x06, 0x860b);
13421 rtl8168_mdio_write(tp, 0x06, 0xe18b);
13422 rtl8168_mdio_write(tp, 0x06, 0x331b);
13423 rtl8168_mdio_write(tp, 0x06, 0x109e);
13424 rtl8168_mdio_write(tp, 0x06, 0x04aa);
13425 rtl8168_mdio_write(tp, 0x06, 0x02ae);
13426 rtl8168_mdio_write(tp, 0x06, 0x06ee);
13427 rtl8168_mdio_write(tp, 0x06, 0x860a);
13428 rtl8168_mdio_write(tp, 0x06, 0x01ae);
13429 rtl8168_mdio_write(tp, 0x06, 0xe602);
13430 rtl8168_mdio_write(tp, 0x06, 0x241e);
13431 rtl8168_mdio_write(tp, 0x06, 0xae14);
13432 rtl8168_mdio_write(tp, 0x06, 0xa001);
13433 rtl8168_mdio_write(tp, 0x06, 0x1402);
13434 rtl8168_mdio_write(tp, 0x06, 0x2426);
13435 rtl8168_mdio_write(tp, 0x06, 0xbf26);
13436 rtl8168_mdio_write(tp, 0x06, 0x6d02);
13437 rtl8168_mdio_write(tp, 0x06, 0x2eb0);
13438 rtl8168_mdio_write(tp, 0x06, 0xee86);
13439 rtl8168_mdio_write(tp, 0x06, 0x0b00);
13440 rtl8168_mdio_write(tp, 0x06, 0xee86);
13441 rtl8168_mdio_write(tp, 0x06, 0x0a02);
13442 rtl8168_mdio_write(tp, 0x06, 0xaf84);
13443 rtl8168_mdio_write(tp, 0x06, 0x3ca0);
13444 rtl8168_mdio_write(tp, 0x06, 0x0252);
13445 rtl8168_mdio_write(tp, 0x06, 0xee86);
13446 rtl8168_mdio_write(tp, 0x06, 0x0400);
13447 rtl8168_mdio_write(tp, 0x06, 0xee86);
13448 rtl8168_mdio_write(tp, 0x06, 0x0500);
13449 rtl8168_mdio_write(tp, 0x06, 0xe086);
13450 rtl8168_mdio_write(tp, 0x06, 0x0be1);
13451 rtl8168_mdio_write(tp, 0x06, 0x8b32);
13452 rtl8168_mdio_write(tp, 0x06, 0x1b10);
13453 rtl8168_mdio_write(tp, 0x06, 0x9e04);
13454 rtl8168_mdio_write(tp, 0x06, 0xaa02);
13455 rtl8168_mdio_write(tp, 0x06, 0xaecb);
13456 rtl8168_mdio_write(tp, 0x06, 0xee86);
13457 rtl8168_mdio_write(tp, 0x06, 0x0b00);
13458 rtl8168_mdio_write(tp, 0x06, 0x0224);
13459 rtl8168_mdio_write(tp, 0x06, 0x3ae2);
13460 rtl8168_mdio_write(tp, 0x06, 0x8604);
13461 rtl8168_mdio_write(tp, 0x06, 0xe386);
13462 rtl8168_mdio_write(tp, 0x06, 0x05ef);
13463 rtl8168_mdio_write(tp, 0x06, 0x65e2);
13464 rtl8168_mdio_write(tp, 0x06, 0x8606);
13465 rtl8168_mdio_write(tp, 0x06, 0xe386);
13466 rtl8168_mdio_write(tp, 0x06, 0x071b);
13467 rtl8168_mdio_write(tp, 0x06, 0x56aa);
13468 rtl8168_mdio_write(tp, 0x06, 0x0eef);
13469 rtl8168_mdio_write(tp, 0x06, 0x56e6);
13470 rtl8168_mdio_write(tp, 0x06, 0x8606);
13471 rtl8168_mdio_write(tp, 0x06, 0xe786);
13472 rtl8168_mdio_write(tp, 0x06, 0x07e2);
13473 rtl8168_mdio_write(tp, 0x06, 0x8609);
13474 rtl8168_mdio_write(tp, 0x06, 0xe686);
13475 rtl8168_mdio_write(tp, 0x06, 0x08e0);
13476 rtl8168_mdio_write(tp, 0x06, 0x8609);
13477 rtl8168_mdio_write(tp, 0x06, 0xa000);
13478 rtl8168_mdio_write(tp, 0x06, 0x07ee);
13479 rtl8168_mdio_write(tp, 0x06, 0x860a);
13480 rtl8168_mdio_write(tp, 0x06, 0x03af);
13481 rtl8168_mdio_write(tp, 0x06, 0x8369);
13482 rtl8168_mdio_write(tp, 0x06, 0x0224);
13483 rtl8168_mdio_write(tp, 0x06, 0x8e02);
13484 rtl8168_mdio_write(tp, 0x06, 0x2426);
13485 rtl8168_mdio_write(tp, 0x06, 0xae48);
13486 rtl8168_mdio_write(tp, 0x06, 0xa003);
13487 rtl8168_mdio_write(tp, 0x06, 0x21e0);
13488 rtl8168_mdio_write(tp, 0x06, 0x8608);
13489 rtl8168_mdio_write(tp, 0x06, 0xe186);
13490 rtl8168_mdio_write(tp, 0x06, 0x091b);
13491 rtl8168_mdio_write(tp, 0x06, 0x019e);
13492 rtl8168_mdio_write(tp, 0x06, 0x0caa);
13493 rtl8168_mdio_write(tp, 0x06, 0x0502);
13494 rtl8168_mdio_write(tp, 0x06, 0x249d);
13495 rtl8168_mdio_write(tp, 0x06, 0xaee7);
13496 rtl8168_mdio_write(tp, 0x06, 0x0224);
13497 rtl8168_mdio_write(tp, 0x06, 0x8eae);
13498 rtl8168_mdio_write(tp, 0x06, 0xe2ee);
13499 rtl8168_mdio_write(tp, 0x06, 0x860a);
13500 rtl8168_mdio_write(tp, 0x06, 0x04ee);
13501 rtl8168_mdio_write(tp, 0x06, 0x860b);
13502 rtl8168_mdio_write(tp, 0x06, 0x00af);
13503 rtl8168_mdio_write(tp, 0x06, 0x8369);
13504 rtl8168_mdio_write(tp, 0x06, 0xa004);
13505 rtl8168_mdio_write(tp, 0x06, 0x15e0);
13506 rtl8168_mdio_write(tp, 0x06, 0x860b);
13507 rtl8168_mdio_write(tp, 0x06, 0xe18b);
13508 rtl8168_mdio_write(tp, 0x06, 0x341b);
13509 rtl8168_mdio_write(tp, 0x06, 0x109e);
13510 rtl8168_mdio_write(tp, 0x06, 0x05aa);
13511 rtl8168_mdio_write(tp, 0x06, 0x03af);
13512 rtl8168_mdio_write(tp, 0x06, 0x8383);
13513 rtl8168_mdio_write(tp, 0x06, 0xee86);
13514 rtl8168_mdio_write(tp, 0x06, 0x0a05);
13515 rtl8168_mdio_write(tp, 0x06, 0xae0c);
13516 rtl8168_mdio_write(tp, 0x06, 0xa005);
13517 rtl8168_mdio_write(tp, 0x06, 0x02ae);
13518 rtl8168_mdio_write(tp, 0x06, 0x0702);
13519 rtl8168_mdio_write(tp, 0x06, 0x2309);
13520 rtl8168_mdio_write(tp, 0x06, 0xee86);
13521 rtl8168_mdio_write(tp, 0x06, 0x0a00);
13522 rtl8168_mdio_write(tp, 0x06, 0xfeef);
13523 rtl8168_mdio_write(tp, 0x06, 0x96fe);
13524 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
13525 rtl8168_mdio_write(tp, 0x06, 0x04f8);
13526 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
13527 rtl8168_mdio_write(tp, 0x06, 0xef69);
13528 rtl8168_mdio_write(tp, 0x06, 0xfbe0);
13529 rtl8168_mdio_write(tp, 0x06, 0x8b85);
13530 rtl8168_mdio_write(tp, 0x06, 0xad25);
13531 rtl8168_mdio_write(tp, 0x06, 0x22e0);
13532 rtl8168_mdio_write(tp, 0x06, 0xe022);
13533 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13534 rtl8168_mdio_write(tp, 0x06, 0x23e2);
13535 rtl8168_mdio_write(tp, 0x06, 0xe036);
13536 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
13537 rtl8168_mdio_write(tp, 0x06, 0x375a);
13538 rtl8168_mdio_write(tp, 0x06, 0xc40d);
13539 rtl8168_mdio_write(tp, 0x06, 0x0158);
13540 rtl8168_mdio_write(tp, 0x06, 0x021e);
13541 rtl8168_mdio_write(tp, 0x06, 0x20e3);
13542 rtl8168_mdio_write(tp, 0x06, 0x8ae7);
13543 rtl8168_mdio_write(tp, 0x06, 0xac31);
13544 rtl8168_mdio_write(tp, 0x06, 0x60ac);
13545 rtl8168_mdio_write(tp, 0x06, 0x3a08);
13546 rtl8168_mdio_write(tp, 0x06, 0xac3e);
13547 rtl8168_mdio_write(tp, 0x06, 0x26ae);
13548 rtl8168_mdio_write(tp, 0x06, 0x67af);
13549 rtl8168_mdio_write(tp, 0x06, 0x84db);
13550 rtl8168_mdio_write(tp, 0x06, 0xad37);
13551 rtl8168_mdio_write(tp, 0x06, 0x61e0);
13552 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
13553 rtl8168_mdio_write(tp, 0x06, 0x10e4);
13554 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
13555 rtl8168_mdio_write(tp, 0x06, 0xe18a);
13556 rtl8168_mdio_write(tp, 0x06, 0xe91b);
13557 rtl8168_mdio_write(tp, 0x06, 0x109e);
13558 rtl8168_mdio_write(tp, 0x06, 0x02ae);
13559 rtl8168_mdio_write(tp, 0x06, 0x51d1);
13560 rtl8168_mdio_write(tp, 0x06, 0x00bf);
13561 rtl8168_mdio_write(tp, 0x06, 0x863b);
13562 rtl8168_mdio_write(tp, 0x06, 0x022f);
13563 rtl8168_mdio_write(tp, 0x06, 0x50ee);
13564 rtl8168_mdio_write(tp, 0x06, 0x8ae8);
13565 rtl8168_mdio_write(tp, 0x06, 0x00ae);
13566 rtl8168_mdio_write(tp, 0x06, 0x43ad);
13567 rtl8168_mdio_write(tp, 0x06, 0x3627);
13568 rtl8168_mdio_write(tp, 0x06, 0xe08a);
13569 rtl8168_mdio_write(tp, 0x06, 0xeee1);
13570 rtl8168_mdio_write(tp, 0x06, 0x8aef);
13571 rtl8168_mdio_write(tp, 0x06, 0xef74);
13572 rtl8168_mdio_write(tp, 0x06, 0xe08a);
13573 rtl8168_mdio_write(tp, 0x06, 0xeae1);
13574 rtl8168_mdio_write(tp, 0x06, 0x8aeb);
13575 rtl8168_mdio_write(tp, 0x06, 0x1b74);
13576 rtl8168_mdio_write(tp, 0x06, 0x9e2e);
13577 rtl8168_mdio_write(tp, 0x06, 0x14e4);
13578 rtl8168_mdio_write(tp, 0x06, 0x8aea);
13579 rtl8168_mdio_write(tp, 0x06, 0xe58a);
13580 rtl8168_mdio_write(tp, 0x06, 0xebef);
13581 rtl8168_mdio_write(tp, 0x06, 0x74e0);
13582 rtl8168_mdio_write(tp, 0x06, 0x8aee);
13583 rtl8168_mdio_write(tp, 0x06, 0xe18a);
13584 rtl8168_mdio_write(tp, 0x06, 0xef1b);
13585 rtl8168_mdio_write(tp, 0x06, 0x479e);
13586 rtl8168_mdio_write(tp, 0x06, 0x0fae);
13587 rtl8168_mdio_write(tp, 0x06, 0x19ee);
13588 rtl8168_mdio_write(tp, 0x06, 0x8aea);
13589 rtl8168_mdio_write(tp, 0x06, 0x00ee);
13590 rtl8168_mdio_write(tp, 0x06, 0x8aeb);
13591 rtl8168_mdio_write(tp, 0x06, 0x00ae);
13592 rtl8168_mdio_write(tp, 0x06, 0x0fac);
13593 rtl8168_mdio_write(tp, 0x06, 0x390c);
13594 rtl8168_mdio_write(tp, 0x06, 0xd101);
13595 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13596 rtl8168_mdio_write(tp, 0x06, 0x3b02);
13597 rtl8168_mdio_write(tp, 0x06, 0x2f50);
13598 rtl8168_mdio_write(tp, 0x06, 0xee8a);
13599 rtl8168_mdio_write(tp, 0x06, 0xe800);
13600 rtl8168_mdio_write(tp, 0x06, 0xe68a);
13601 rtl8168_mdio_write(tp, 0x06, 0xe7ff);
13602 rtl8168_mdio_write(tp, 0x06, 0xef96);
13603 rtl8168_mdio_write(tp, 0x06, 0xfefd);
13604 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13605 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
13606 rtl8168_mdio_write(tp, 0x06, 0xfaef);
13607 rtl8168_mdio_write(tp, 0x06, 0x69e0);
13608 rtl8168_mdio_write(tp, 0x06, 0xe022);
13609 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13610 rtl8168_mdio_write(tp, 0x06, 0x2358);
13611 rtl8168_mdio_write(tp, 0x06, 0xc4e1);
13612 rtl8168_mdio_write(tp, 0x06, 0x8b6e);
13613 rtl8168_mdio_write(tp, 0x06, 0x1f10);
13614 rtl8168_mdio_write(tp, 0x06, 0x9e24);
13615 rtl8168_mdio_write(tp, 0x06, 0xe48b);
13616 rtl8168_mdio_write(tp, 0x06, 0x6ead);
13617 rtl8168_mdio_write(tp, 0x06, 0x2218);
13618 rtl8168_mdio_write(tp, 0x06, 0xac27);
13619 rtl8168_mdio_write(tp, 0x06, 0x0dac);
13620 rtl8168_mdio_write(tp, 0x06, 0x2605);
13621 rtl8168_mdio_write(tp, 0x06, 0x0203);
13622 rtl8168_mdio_write(tp, 0x06, 0x8fae);
13623 rtl8168_mdio_write(tp, 0x06, 0x1302);
13624 rtl8168_mdio_write(tp, 0x06, 0x03c8);
13625 rtl8168_mdio_write(tp, 0x06, 0xae0e);
13626 rtl8168_mdio_write(tp, 0x06, 0x0203);
13627 rtl8168_mdio_write(tp, 0x06, 0xe102);
13628 rtl8168_mdio_write(tp, 0x06, 0x8520);
13629 rtl8168_mdio_write(tp, 0x06, 0xae06);
13630 rtl8168_mdio_write(tp, 0x06, 0x0203);
13631 rtl8168_mdio_write(tp, 0x06, 0x8f02);
13632 rtl8168_mdio_write(tp, 0x06, 0x8566);
13633 rtl8168_mdio_write(tp, 0x06, 0xef96);
13634 rtl8168_mdio_write(tp, 0x06, 0xfefd);
13635 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13636 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
13637 rtl8168_mdio_write(tp, 0x06, 0xef69);
13638 rtl8168_mdio_write(tp, 0x06, 0xe08b);
13639 rtl8168_mdio_write(tp, 0x06, 0x82ad);
13640 rtl8168_mdio_write(tp, 0x06, 0x2737);
13641 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13642 rtl8168_mdio_write(tp, 0x06, 0x4402);
13643 rtl8168_mdio_write(tp, 0x06, 0x2f23);
13644 rtl8168_mdio_write(tp, 0x06, 0xac28);
13645 rtl8168_mdio_write(tp, 0x06, 0x2ed1);
13646 rtl8168_mdio_write(tp, 0x06, 0x01bf);
13647 rtl8168_mdio_write(tp, 0x06, 0x8647);
13648 rtl8168_mdio_write(tp, 0x06, 0x022f);
13649 rtl8168_mdio_write(tp, 0x06, 0x50bf);
13650 rtl8168_mdio_write(tp, 0x06, 0x8641);
13651 rtl8168_mdio_write(tp, 0x06, 0x022f);
13652 rtl8168_mdio_write(tp, 0x06, 0x23e5);
13653 rtl8168_mdio_write(tp, 0x06, 0x8af0);
13654 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13655 rtl8168_mdio_write(tp, 0x06, 0x22e1);
13656 rtl8168_mdio_write(tp, 0x06, 0xe023);
13657 rtl8168_mdio_write(tp, 0x06, 0xac2e);
13658 rtl8168_mdio_write(tp, 0x06, 0x04d1);
13659 rtl8168_mdio_write(tp, 0x06, 0x01ae);
13660 rtl8168_mdio_write(tp, 0x06, 0x02d1);
13661 rtl8168_mdio_write(tp, 0x06, 0x00bf);
13662 rtl8168_mdio_write(tp, 0x06, 0x8641);
13663 rtl8168_mdio_write(tp, 0x06, 0x022f);
13664 rtl8168_mdio_write(tp, 0x06, 0x50d1);
13665 rtl8168_mdio_write(tp, 0x06, 0x01bf);
13666 rtl8168_mdio_write(tp, 0x06, 0x8644);
13667 rtl8168_mdio_write(tp, 0x06, 0x022f);
13668 rtl8168_mdio_write(tp, 0x06, 0x50ef);
13669 rtl8168_mdio_write(tp, 0x06, 0x96fe);
13670 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13671 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
13672 rtl8168_mdio_write(tp, 0x06, 0xef69);
13673 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13674 rtl8168_mdio_write(tp, 0x06, 0x4702);
13675 rtl8168_mdio_write(tp, 0x06, 0x2f23);
13676 rtl8168_mdio_write(tp, 0x06, 0xad28);
13677 rtl8168_mdio_write(tp, 0x06, 0x19d1);
13678 rtl8168_mdio_write(tp, 0x06, 0x00bf);
13679 rtl8168_mdio_write(tp, 0x06, 0x8644);
13680 rtl8168_mdio_write(tp, 0x06, 0x022f);
13681 rtl8168_mdio_write(tp, 0x06, 0x50e1);
13682 rtl8168_mdio_write(tp, 0x06, 0x8af0);
13683 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13684 rtl8168_mdio_write(tp, 0x06, 0x4102);
13685 rtl8168_mdio_write(tp, 0x06, 0x2f50);
13686 rtl8168_mdio_write(tp, 0x06, 0xd100);
13687 rtl8168_mdio_write(tp, 0x06, 0xbf86);
13688 rtl8168_mdio_write(tp, 0x06, 0x4702);
13689 rtl8168_mdio_write(tp, 0x06, 0x2f50);
13690 rtl8168_mdio_write(tp, 0x06, 0xef96);
13691 rtl8168_mdio_write(tp, 0x06, 0xfefc);
13692 rtl8168_mdio_write(tp, 0x06, 0x04f8);
13693 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13694 rtl8168_mdio_write(tp, 0x06, 0xfee1);
13695 rtl8168_mdio_write(tp, 0x06, 0xe2ff);
13696 rtl8168_mdio_write(tp, 0x06, 0xad2e);
13697 rtl8168_mdio_write(tp, 0x06, 0x63e0);
13698 rtl8168_mdio_write(tp, 0x06, 0xe038);
13699 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
13700 rtl8168_mdio_write(tp, 0x06, 0x39ad);
13701 rtl8168_mdio_write(tp, 0x06, 0x2f10);
13702 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13703 rtl8168_mdio_write(tp, 0x06, 0x34e1);
13704 rtl8168_mdio_write(tp, 0x06, 0xe035);
13705 rtl8168_mdio_write(tp, 0x06, 0xf726);
13706 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
13707 rtl8168_mdio_write(tp, 0x06, 0x34e5);
13708 rtl8168_mdio_write(tp, 0x06, 0xe035);
13709 rtl8168_mdio_write(tp, 0x06, 0xae0e);
13710 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13711 rtl8168_mdio_write(tp, 0x06, 0xd6e1);
13712 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
13713 rtl8168_mdio_write(tp, 0x06, 0xf728);
13714 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
13715 rtl8168_mdio_write(tp, 0x06, 0xd6e5);
13716 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
13717 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13718 rtl8168_mdio_write(tp, 0x06, 0x34e1);
13719 rtl8168_mdio_write(tp, 0x06, 0xe235);
13720 rtl8168_mdio_write(tp, 0x06, 0xf72b);
13721 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
13722 rtl8168_mdio_write(tp, 0x06, 0x34e5);
13723 rtl8168_mdio_write(tp, 0x06, 0xe235);
13724 rtl8168_mdio_write(tp, 0x06, 0xd07d);
13725 rtl8168_mdio_write(tp, 0x06, 0xb0fe);
13726 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13727 rtl8168_mdio_write(tp, 0x06, 0x34e1);
13728 rtl8168_mdio_write(tp, 0x06, 0xe235);
13729 rtl8168_mdio_write(tp, 0x06, 0xf62b);
13730 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
13731 rtl8168_mdio_write(tp, 0x06, 0x34e5);
13732 rtl8168_mdio_write(tp, 0x06, 0xe235);
13733 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
13734 rtl8168_mdio_write(tp, 0x06, 0x34e1);
13735 rtl8168_mdio_write(tp, 0x06, 0xe035);
13736 rtl8168_mdio_write(tp, 0x06, 0xf626);
13737 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
13738 rtl8168_mdio_write(tp, 0x06, 0x34e5);
13739 rtl8168_mdio_write(tp, 0x06, 0xe035);
13740 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
13741 rtl8168_mdio_write(tp, 0x06, 0xd6e1);
13742 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
13743 rtl8168_mdio_write(tp, 0x06, 0xf628);
13744 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
13745 rtl8168_mdio_write(tp, 0x06, 0xd6e5);
13746 rtl8168_mdio_write(tp, 0x06, 0xe2d7);
13747 rtl8168_mdio_write(tp, 0x06, 0xfc04);
13748 rtl8168_mdio_write(tp, 0x06, 0xae20);
13749 rtl8168_mdio_write(tp, 0x06, 0x0000);
13750 rtl8168_mdio_write(tp, 0x06, 0x0000);
13751 rtl8168_mdio_write(tp, 0x06, 0x0000);
13752 rtl8168_mdio_write(tp, 0x06, 0x0000);
13753 rtl8168_mdio_write(tp, 0x06, 0x0000);
13754 rtl8168_mdio_write(tp, 0x06, 0x0000);
13755 rtl8168_mdio_write(tp, 0x06, 0x0000);
13756 rtl8168_mdio_write(tp, 0x06, 0x0000);
13757 rtl8168_mdio_write(tp, 0x06, 0x0000);
13758 rtl8168_mdio_write(tp, 0x06, 0x0000);
13759 rtl8168_mdio_write(tp, 0x06, 0x0000);
13760 rtl8168_mdio_write(tp, 0x06, 0x0000);
13761 rtl8168_mdio_write(tp, 0x06, 0x0000);
13762 rtl8168_mdio_write(tp, 0x06, 0x0000);
13763 rtl8168_mdio_write(tp, 0x06, 0x0000);
13764 rtl8168_mdio_write(tp, 0x06, 0x0000);
13765 rtl8168_mdio_write(tp, 0x06, 0xa725);
13766 rtl8168_mdio_write(tp, 0x06, 0xe50a);
13767 rtl8168_mdio_write(tp, 0x06, 0x1de5);
13768 rtl8168_mdio_write(tp, 0x06, 0x0a2c);
13769 rtl8168_mdio_write(tp, 0x06, 0xe50a);
13770 rtl8168_mdio_write(tp, 0x06, 0x6de5);
13771 rtl8168_mdio_write(tp, 0x06, 0x0a1d);
13772 rtl8168_mdio_write(tp, 0x06, 0xe50a);
13773 rtl8168_mdio_write(tp, 0x06, 0x1ce5);
13774 rtl8168_mdio_write(tp, 0x06, 0x0a2d);
13775 rtl8168_mdio_write(tp, 0x06, 0xa755);
13776 rtl8168_mdio_write(tp, 0x06, 0x00e2);
13777 rtl8168_mdio_write(tp, 0x06, 0x3488);
13778 rtl8168_mdio_write(tp, 0x06, 0xe200);
13779 rtl8168_mdio_write(tp, 0x06, 0xcce2);
13780 rtl8168_mdio_write(tp, 0x06, 0x0055);
13781 rtl8168_mdio_write(tp, 0x06, 0xe020);
13782 rtl8168_mdio_write(tp, 0x06, 0x55e2);
13783 rtl8168_mdio_write(tp, 0x06, 0xd600);
13784 rtl8168_mdio_write(tp, 0x06, 0xe24a);
13785 gphy_val = rtl8168_mdio_read(tp, 0x01);
13786 gphy_val |= BIT_0;
13787 rtl8168_mdio_write(tp, 0x01, gphy_val);
13788 gphy_val = rtl8168_mdio_read(tp, 0x00);
13789 gphy_val |= BIT_0;
13790 rtl8168_mdio_write(tp, 0x00, gphy_val);
13791 rtl8168_mdio_write(tp, 0x1f, 0x0000);
13792
13793 rtl8168_mdio_write(tp, 0x1f, 0x0005);
13794 for (i = 0; i < 200; i++) {
13795 udelay(100);
13796 gphy_val = rtl8168_mdio_read(tp, 0x00);
13797 if (gphy_val & BIT_7)
13798 break;
13799 }
13800 rtl8168_mdio_write(tp, 0x1f, 0x0007);
13801 rtl8168_mdio_write(tp, 0x1e, 0x0023);
13802 gphy_val = rtl8168_mdio_read(tp, 0x17);
13803 gphy_val &= ~(BIT_0);
13804 if (tp->RequiredSecLanDonglePatch)
13805 gphy_val &= ~(BIT_2);
13806 rtl8168_mdio_write(tp, 0x17, gphy_val);
13807 rtl8168_mdio_write(tp, 0x1f, 0x0000);
13808 }
13809 }
13810
13811 static void
rtl8168_set_phy_mcu_8168evl_1(struct net_device * dev)13812 rtl8168_set_phy_mcu_8168evl_1(struct net_device *dev)
13813 {
13814 struct rtl8168_private *tp = netdev_priv(dev);
13815 unsigned int gphy_val,i;
13816
13817 rtl8168_mdio_write(tp, 0x1f, 0x0000);
13818 rtl8168_mdio_write(tp, 0x00, 0x1800);
13819 gphy_val = rtl8168_mdio_read(tp, 0x15);
13820 gphy_val &= ~(BIT_12);
13821 rtl8168_mdio_write(tp, 0x15, gphy_val);
13822 mdelay(20);
13823 rtl8168_mdio_write(tp, 0x1f, 0x0004);
13824 rtl8168_mdio_write(tp, 0x1f, 0x0007);
13825 rtl8168_mdio_write(tp, 0x1e, 0x0023);
13826 gphy_val = rtl8168_mdio_read(tp, 0x17);
13827 if ((gphy_val & BIT_11) == 0x0000) {
13828 gphy_val |= BIT_0;
13829 rtl8168_mdio_write(tp, 0x17, gphy_val);
13830 for (i = 0; i < 200; i++) {
13831 udelay(100);
13832 gphy_val = rtl8168_mdio_read(tp, 0x17);
13833 if (gphy_val & BIT_11)
13834 break;
13835 }
13836 }
13837 gphy_val = rtl8168_mdio_read(tp, 0x17);
13838 gphy_val |= BIT_0;
13839 rtl8168_mdio_write(tp, 0x17, gphy_val);
13840 rtl8168_mdio_write(tp, 0x1f, 0x0004);
13841 rtl8168_mdio_write(tp, 0x1f, 0x0007);
13842 rtl8168_mdio_write(tp, 0x1E, 0x002C);
13843 rtl8168_mdio_write(tp, 0x1B, 0x5000);
13844 rtl8168_mdio_write(tp, 0x1E, 0x002d);
13845 rtl8168_mdio_write(tp, 0x19, 0x0004);
13846 rtl8168_mdio_write(tp, 0x1f, 0x0002);
13847 rtl8168_mdio_write(tp, 0x1f, 0x0000);
13848 for (i = 0; i < 200; i++) {
13849 udelay(100);
13850 gphy_val = rtl8168_mdio_read(tp, 0x1E);
13851 if ((gphy_val & 0x03FF) == 0x0014)
13852 break;
13853 }
13854 rtl8168_mdio_write(tp, 0x1f, 0x0005);
13855 for (i = 0; i < 200; i++) {
13856 udelay(100);
13857 gphy_val = rtl8168_mdio_read(tp, 0x07);
13858 if ((gphy_val & BIT_5) == 0)
13859 break;
13860 }
13861 gphy_val = rtl8168_mdio_read(tp, 0x07);
13862 if (gphy_val & BIT_5) {
13863 rtl8168_mdio_write(tp, 0x1f, 0x0004);
13864 rtl8168_mdio_write(tp, 0x1f, 0x0007);
13865 rtl8168_mdio_write(tp, 0x1e, 0x00a1);
13866 rtl8168_mdio_write(tp, 0x17, 0x1000);
13867 rtl8168_mdio_write(tp, 0x17, 0x0000);
13868 rtl8168_mdio_write(tp, 0x17, 0x2000);
13869 rtl8168_mdio_write(tp, 0x1e, 0x002f);
13870 rtl8168_mdio_write(tp, 0x18, 0x9bfb);
13871 rtl8168_mdio_write(tp, 0x1f, 0x0005);
13872 rtl8168_mdio_write(tp, 0x07, 0x0000);
13873 rtl8168_mdio_write(tp, 0x1f, 0x0002);
13874 rtl8168_mdio_write(tp, 0x1f, 0x0000);
13875 }
13876 rtl8168_mdio_write(tp, 0x1f, 0x0005);
13877 rtl8168_mdio_write(tp, 0x05, 0xfff6);
13878 rtl8168_mdio_write(tp, 0x06, 0x0080);
13879 gphy_val = rtl8168_mdio_read(tp, 0x00);
13880 gphy_val &= ~(BIT_7);
13881 rtl8168_mdio_write(tp, 0x00, gphy_val);
13882 rtl8168_mdio_write(tp, 0x1f, 0x0004);
13883 rtl8168_mdio_write(tp, 0x1f, 0x0007);
13884 rtl8168_mdio_write(tp, 0x1e, 0x0023);
13885 rtl8168_mdio_write(tp, 0x16, 0x0306);
13886 rtl8168_mdio_write(tp, 0x16, 0x0307);
13887 rtl8168_mdio_write(tp, 0x15, 0x0000);
13888 rtl8168_mdio_write(tp, 0x19, 0x407d);
13889 rtl8168_mdio_write(tp, 0x15, 0x0001);
13890 rtl8168_mdio_write(tp, 0x19, 0x440f);
13891 rtl8168_mdio_write(tp, 0x15, 0x0002);
13892 rtl8168_mdio_write(tp, 0x19, 0x7c03);
13893 rtl8168_mdio_write(tp, 0x15, 0x0003);
13894 rtl8168_mdio_write(tp, 0x19, 0x6c03);
13895 rtl8168_mdio_write(tp, 0x15, 0x0004);
13896 rtl8168_mdio_write(tp, 0x19, 0xc4d5);
13897 rtl8168_mdio_write(tp, 0x15, 0x0005);
13898 rtl8168_mdio_write(tp, 0x19, 0x00ff);
13899 rtl8168_mdio_write(tp, 0x15, 0x0006);
13900 rtl8168_mdio_write(tp, 0x19, 0x74f0);
13901 rtl8168_mdio_write(tp, 0x15, 0x0007);
13902 rtl8168_mdio_write(tp, 0x19, 0x4880);
13903 rtl8168_mdio_write(tp, 0x15, 0x0008);
13904 rtl8168_mdio_write(tp, 0x19, 0x4c00);
13905 rtl8168_mdio_write(tp, 0x15, 0x0009);
13906 rtl8168_mdio_write(tp, 0x19, 0x4800);
13907 rtl8168_mdio_write(tp, 0x15, 0x000a);
13908 rtl8168_mdio_write(tp, 0x19, 0x5000);
13909 rtl8168_mdio_write(tp, 0x15, 0x000b);
13910 rtl8168_mdio_write(tp, 0x19, 0x4400);
13911 rtl8168_mdio_write(tp, 0x15, 0x000c);
13912 rtl8168_mdio_write(tp, 0x19, 0x7801);
13913 rtl8168_mdio_write(tp, 0x15, 0x000d);
13914 rtl8168_mdio_write(tp, 0x19, 0x4000);
13915 rtl8168_mdio_write(tp, 0x15, 0x000e);
13916 rtl8168_mdio_write(tp, 0x19, 0x7800);
13917 rtl8168_mdio_write(tp, 0x15, 0x000f);
13918 rtl8168_mdio_write(tp, 0x19, 0x7010);
13919 rtl8168_mdio_write(tp, 0x15, 0x0010);
13920 rtl8168_mdio_write(tp, 0x19, 0x6804);
13921 rtl8168_mdio_write(tp, 0x15, 0x0011);
13922 rtl8168_mdio_write(tp, 0x19, 0x64a0);
13923 rtl8168_mdio_write(tp, 0x15, 0x0012);
13924 rtl8168_mdio_write(tp, 0x19, 0x63da);
13925 rtl8168_mdio_write(tp, 0x15, 0x0013);
13926 rtl8168_mdio_write(tp, 0x19, 0x63d8);
13927 rtl8168_mdio_write(tp, 0x15, 0x0014);
13928 rtl8168_mdio_write(tp, 0x19, 0x6f05);
13929 rtl8168_mdio_write(tp, 0x15, 0x0015);
13930 rtl8168_mdio_write(tp, 0x19, 0x5420);
13931 rtl8168_mdio_write(tp, 0x15, 0x0016);
13932 rtl8168_mdio_write(tp, 0x19, 0x58ce);
13933 rtl8168_mdio_write(tp, 0x15, 0x0017);
13934 rtl8168_mdio_write(tp, 0x19, 0x5cf3);
13935 rtl8168_mdio_write(tp, 0x15, 0x0018);
13936 rtl8168_mdio_write(tp, 0x19, 0xb600);
13937 rtl8168_mdio_write(tp, 0x15, 0x0019);
13938 rtl8168_mdio_write(tp, 0x19, 0xc659);
13939 rtl8168_mdio_write(tp, 0x15, 0x001a);
13940 rtl8168_mdio_write(tp, 0x19, 0x0018);
13941 rtl8168_mdio_write(tp, 0x15, 0x001b);
13942 rtl8168_mdio_write(tp, 0x19, 0xc403);
13943 rtl8168_mdio_write(tp, 0x15, 0x001c);
13944 rtl8168_mdio_write(tp, 0x19, 0x0016);
13945 rtl8168_mdio_write(tp, 0x15, 0x001d);
13946 rtl8168_mdio_write(tp, 0x19, 0xaa05);
13947 rtl8168_mdio_write(tp, 0x15, 0x001e);
13948 rtl8168_mdio_write(tp, 0x19, 0xc503);
13949 rtl8168_mdio_write(tp, 0x15, 0x001f);
13950 rtl8168_mdio_write(tp, 0x19, 0x0003);
13951 rtl8168_mdio_write(tp, 0x15, 0x0020);
13952 rtl8168_mdio_write(tp, 0x19, 0x89f8);
13953 rtl8168_mdio_write(tp, 0x15, 0x0021);
13954 rtl8168_mdio_write(tp, 0x19, 0x32ae);
13955 rtl8168_mdio_write(tp, 0x15, 0x0022);
13956 rtl8168_mdio_write(tp, 0x19, 0x7c03);
13957 rtl8168_mdio_write(tp, 0x15, 0x0023);
13958 rtl8168_mdio_write(tp, 0x19, 0x6c03);
13959 rtl8168_mdio_write(tp, 0x15, 0x0024);
13960 rtl8168_mdio_write(tp, 0x19, 0x7c03);
13961 rtl8168_mdio_write(tp, 0x15, 0x0025);
13962 rtl8168_mdio_write(tp, 0x19, 0x6801);
13963 rtl8168_mdio_write(tp, 0x15, 0x0026);
13964 rtl8168_mdio_write(tp, 0x19, 0x66a0);
13965 rtl8168_mdio_write(tp, 0x15, 0x0027);
13966 rtl8168_mdio_write(tp, 0x19, 0xa300);
13967 rtl8168_mdio_write(tp, 0x15, 0x0028);
13968 rtl8168_mdio_write(tp, 0x19, 0x64a0);
13969 rtl8168_mdio_write(tp, 0x15, 0x0029);
13970 rtl8168_mdio_write(tp, 0x19, 0x76f0);
13971 rtl8168_mdio_write(tp, 0x15, 0x002a);
13972 rtl8168_mdio_write(tp, 0x19, 0x7670);
13973 rtl8168_mdio_write(tp, 0x15, 0x002b);
13974 rtl8168_mdio_write(tp, 0x19, 0x7630);
13975 rtl8168_mdio_write(tp, 0x15, 0x002c);
13976 rtl8168_mdio_write(tp, 0x19, 0x31a6);
13977 rtl8168_mdio_write(tp, 0x15, 0x002d);
13978 rtl8168_mdio_write(tp, 0x19, 0x0000);
13979 rtl8168_mdio_write(tp, 0x15, 0x002e);
13980 rtl8168_mdio_write(tp, 0x19, 0x0000);
13981 rtl8168_mdio_write(tp, 0x15, 0x002f);
13982 rtl8168_mdio_write(tp, 0x19, 0x0000);
13983 rtl8168_mdio_write(tp, 0x15, 0x0030);
13984 rtl8168_mdio_write(tp, 0x19, 0x0000);
13985 rtl8168_mdio_write(tp, 0x15, 0x0031);
13986 rtl8168_mdio_write(tp, 0x19, 0x0000);
13987 rtl8168_mdio_write(tp, 0x15, 0x0032);
13988 rtl8168_mdio_write(tp, 0x19, 0x4801);
13989 rtl8168_mdio_write(tp, 0x15, 0x0033);
13990 rtl8168_mdio_write(tp, 0x19, 0x6803);
13991 rtl8168_mdio_write(tp, 0x15, 0x0034);
13992 rtl8168_mdio_write(tp, 0x19, 0x66a1);
13993 rtl8168_mdio_write(tp, 0x15, 0x0035);
13994 rtl8168_mdio_write(tp, 0x19, 0x7c03);
13995 rtl8168_mdio_write(tp, 0x15, 0x0036);
13996 rtl8168_mdio_write(tp, 0x19, 0x6c03);
13997 rtl8168_mdio_write(tp, 0x15, 0x0037);
13998 rtl8168_mdio_write(tp, 0x19, 0xa300);
13999 rtl8168_mdio_write(tp, 0x15, 0x0038);
14000 rtl8168_mdio_write(tp, 0x19, 0x64a1);
14001 rtl8168_mdio_write(tp, 0x15, 0x0039);
14002 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14003 rtl8168_mdio_write(tp, 0x15, 0x003a);
14004 rtl8168_mdio_write(tp, 0x19, 0x74f8);
14005 rtl8168_mdio_write(tp, 0x15, 0x003b);
14006 rtl8168_mdio_write(tp, 0x19, 0x63d0);
14007 rtl8168_mdio_write(tp, 0x15, 0x003c);
14008 rtl8168_mdio_write(tp, 0x19, 0x7ff0);
14009 rtl8168_mdio_write(tp, 0x15, 0x003d);
14010 rtl8168_mdio_write(tp, 0x19, 0x77f0);
14011 rtl8168_mdio_write(tp, 0x15, 0x003e);
14012 rtl8168_mdio_write(tp, 0x19, 0x7ff0);
14013 rtl8168_mdio_write(tp, 0x15, 0x003f);
14014 rtl8168_mdio_write(tp, 0x19, 0x7750);
14015 rtl8168_mdio_write(tp, 0x15, 0x0040);
14016 rtl8168_mdio_write(tp, 0x19, 0x63d8);
14017 rtl8168_mdio_write(tp, 0x15, 0x0041);
14018 rtl8168_mdio_write(tp, 0x19, 0x7cf0);
14019 rtl8168_mdio_write(tp, 0x15, 0x0042);
14020 rtl8168_mdio_write(tp, 0x19, 0x7708);
14021 rtl8168_mdio_write(tp, 0x15, 0x0043);
14022 rtl8168_mdio_write(tp, 0x19, 0xa654);
14023 rtl8168_mdio_write(tp, 0x15, 0x0044);
14024 rtl8168_mdio_write(tp, 0x19, 0x304a);
14025 rtl8168_mdio_write(tp, 0x15, 0x0045);
14026 rtl8168_mdio_write(tp, 0x19, 0x0000);
14027 rtl8168_mdio_write(tp, 0x15, 0x0046);
14028 rtl8168_mdio_write(tp, 0x19, 0x0000);
14029 rtl8168_mdio_write(tp, 0x15, 0x0047);
14030 rtl8168_mdio_write(tp, 0x19, 0x0000);
14031 rtl8168_mdio_write(tp, 0x15, 0x0048);
14032 rtl8168_mdio_write(tp, 0x19, 0x0000);
14033 rtl8168_mdio_write(tp, 0x15, 0x0049);
14034 rtl8168_mdio_write(tp, 0x19, 0x0000);
14035 rtl8168_mdio_write(tp, 0x15, 0x004a);
14036 rtl8168_mdio_write(tp, 0x19, 0x4802);
14037 rtl8168_mdio_write(tp, 0x15, 0x004b);
14038 rtl8168_mdio_write(tp, 0x19, 0x4003);
14039 rtl8168_mdio_write(tp, 0x15, 0x004c);
14040 rtl8168_mdio_write(tp, 0x19, 0x4440);
14041 rtl8168_mdio_write(tp, 0x15, 0x004d);
14042 rtl8168_mdio_write(tp, 0x19, 0x63c8);
14043 rtl8168_mdio_write(tp, 0x15, 0x004e);
14044 rtl8168_mdio_write(tp, 0x19, 0x6481);
14045 rtl8168_mdio_write(tp, 0x15, 0x004f);
14046 rtl8168_mdio_write(tp, 0x19, 0x9d00);
14047 rtl8168_mdio_write(tp, 0x15, 0x0050);
14048 rtl8168_mdio_write(tp, 0x19, 0x63e8);
14049 rtl8168_mdio_write(tp, 0x15, 0x0051);
14050 rtl8168_mdio_write(tp, 0x19, 0x7d00);
14051 rtl8168_mdio_write(tp, 0x15, 0x0052);
14052 rtl8168_mdio_write(tp, 0x19, 0x5900);
14053 rtl8168_mdio_write(tp, 0x15, 0x0053);
14054 rtl8168_mdio_write(tp, 0x19, 0x63f8);
14055 rtl8168_mdio_write(tp, 0x15, 0x0054);
14056 rtl8168_mdio_write(tp, 0x19, 0x64a1);
14057 rtl8168_mdio_write(tp, 0x15, 0x0055);
14058 rtl8168_mdio_write(tp, 0x19, 0x3116);
14059 rtl8168_mdio_write(tp, 0x15, 0x0056);
14060 rtl8168_mdio_write(tp, 0x19, 0x0000);
14061 rtl8168_mdio_write(tp, 0x15, 0x0057);
14062 rtl8168_mdio_write(tp, 0x19, 0x0000);
14063 rtl8168_mdio_write(tp, 0x15, 0x0058);
14064 rtl8168_mdio_write(tp, 0x19, 0x0000);
14065 rtl8168_mdio_write(tp, 0x15, 0x0059);
14066 rtl8168_mdio_write(tp, 0x19, 0x0000);
14067 rtl8168_mdio_write(tp, 0x15, 0x005a);
14068 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14069 rtl8168_mdio_write(tp, 0x15, 0x005b);
14070 rtl8168_mdio_write(tp, 0x19, 0x6c03);
14071 rtl8168_mdio_write(tp, 0x15, 0x005c);
14072 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14073 rtl8168_mdio_write(tp, 0x15, 0x005d);
14074 rtl8168_mdio_write(tp, 0x19, 0x6000);
14075 rtl8168_mdio_write(tp, 0x15, 0x005e);
14076 rtl8168_mdio_write(tp, 0x19, 0x59ce);
14077 rtl8168_mdio_write(tp, 0x15, 0x005f);
14078 rtl8168_mdio_write(tp, 0x19, 0x4400);
14079 rtl8168_mdio_write(tp, 0x15, 0x0060);
14080 rtl8168_mdio_write(tp, 0x19, 0x7d00);
14081 rtl8168_mdio_write(tp, 0x15, 0x0061);
14082 rtl8168_mdio_write(tp, 0x19, 0x72b0);
14083 rtl8168_mdio_write(tp, 0x15, 0x0062);
14084 rtl8168_mdio_write(tp, 0x19, 0x400e);
14085 rtl8168_mdio_write(tp, 0x15, 0x0063);
14086 rtl8168_mdio_write(tp, 0x19, 0x4440);
14087 rtl8168_mdio_write(tp, 0x15, 0x0064);
14088 rtl8168_mdio_write(tp, 0x19, 0x9d00);
14089 rtl8168_mdio_write(tp, 0x15, 0x0065);
14090 rtl8168_mdio_write(tp, 0x19, 0x7f00);
14091 rtl8168_mdio_write(tp, 0x15, 0x0066);
14092 rtl8168_mdio_write(tp, 0x19, 0x70b0);
14093 rtl8168_mdio_write(tp, 0x15, 0x0067);
14094 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14095 rtl8168_mdio_write(tp, 0x15, 0x0068);
14096 rtl8168_mdio_write(tp, 0x19, 0x6008);
14097 rtl8168_mdio_write(tp, 0x15, 0x0069);
14098 rtl8168_mdio_write(tp, 0x19, 0x7cf0);
14099 rtl8168_mdio_write(tp, 0x15, 0x006a);
14100 rtl8168_mdio_write(tp, 0x19, 0x7750);
14101 rtl8168_mdio_write(tp, 0x15, 0x006b);
14102 rtl8168_mdio_write(tp, 0x19, 0x4007);
14103 rtl8168_mdio_write(tp, 0x15, 0x006c);
14104 rtl8168_mdio_write(tp, 0x19, 0x4500);
14105 rtl8168_mdio_write(tp, 0x15, 0x006d);
14106 rtl8168_mdio_write(tp, 0x19, 0x4023);
14107 rtl8168_mdio_write(tp, 0x15, 0x006e);
14108 rtl8168_mdio_write(tp, 0x19, 0x4580);
14109 rtl8168_mdio_write(tp, 0x15, 0x006f);
14110 rtl8168_mdio_write(tp, 0x19, 0x9f00);
14111 rtl8168_mdio_write(tp, 0x15, 0x0070);
14112 rtl8168_mdio_write(tp, 0x19, 0xcd78);
14113 rtl8168_mdio_write(tp, 0x15, 0x0071);
14114 rtl8168_mdio_write(tp, 0x19, 0x0003);
14115 rtl8168_mdio_write(tp, 0x15, 0x0072);
14116 rtl8168_mdio_write(tp, 0x19, 0xbe02);
14117 rtl8168_mdio_write(tp, 0x15, 0x0073);
14118 rtl8168_mdio_write(tp, 0x19, 0x3070);
14119 rtl8168_mdio_write(tp, 0x15, 0x0074);
14120 rtl8168_mdio_write(tp, 0x19, 0x7cf0);
14121 rtl8168_mdio_write(tp, 0x15, 0x0075);
14122 rtl8168_mdio_write(tp, 0x19, 0x77f0);
14123 rtl8168_mdio_write(tp, 0x15, 0x0076);
14124 rtl8168_mdio_write(tp, 0x19, 0x4400);
14125 rtl8168_mdio_write(tp, 0x15, 0x0077);
14126 rtl8168_mdio_write(tp, 0x19, 0x4007);
14127 rtl8168_mdio_write(tp, 0x15, 0x0078);
14128 rtl8168_mdio_write(tp, 0x19, 0x4500);
14129 rtl8168_mdio_write(tp, 0x15, 0x0079);
14130 rtl8168_mdio_write(tp, 0x19, 0x4023);
14131 rtl8168_mdio_write(tp, 0x15, 0x007a);
14132 rtl8168_mdio_write(tp, 0x19, 0x4580);
14133 rtl8168_mdio_write(tp, 0x15, 0x007b);
14134 rtl8168_mdio_write(tp, 0x19, 0x9f00);
14135 rtl8168_mdio_write(tp, 0x15, 0x007c);
14136 rtl8168_mdio_write(tp, 0x19, 0xce80);
14137 rtl8168_mdio_write(tp, 0x15, 0x007d);
14138 rtl8168_mdio_write(tp, 0x19, 0x0004);
14139 rtl8168_mdio_write(tp, 0x15, 0x007e);
14140 rtl8168_mdio_write(tp, 0x19, 0xce80);
14141 rtl8168_mdio_write(tp, 0x15, 0x007f);
14142 rtl8168_mdio_write(tp, 0x19, 0x0002);
14143 rtl8168_mdio_write(tp, 0x15, 0x0080);
14144 rtl8168_mdio_write(tp, 0x19, 0x307c);
14145 rtl8168_mdio_write(tp, 0x15, 0x0081);
14146 rtl8168_mdio_write(tp, 0x19, 0x4400);
14147 rtl8168_mdio_write(tp, 0x15, 0x0082);
14148 rtl8168_mdio_write(tp, 0x19, 0x480f);
14149 rtl8168_mdio_write(tp, 0x15, 0x0083);
14150 rtl8168_mdio_write(tp, 0x19, 0x6802);
14151 rtl8168_mdio_write(tp, 0x15, 0x0084);
14152 rtl8168_mdio_write(tp, 0x19, 0x6680);
14153 rtl8168_mdio_write(tp, 0x15, 0x0085);
14154 rtl8168_mdio_write(tp, 0x19, 0x7c10);
14155 rtl8168_mdio_write(tp, 0x15, 0x0086);
14156 rtl8168_mdio_write(tp, 0x19, 0x6010);
14157 rtl8168_mdio_write(tp, 0x15, 0x0087);
14158 rtl8168_mdio_write(tp, 0x19, 0x400a);
14159 rtl8168_mdio_write(tp, 0x15, 0x0088);
14160 rtl8168_mdio_write(tp, 0x19, 0x4580);
14161 rtl8168_mdio_write(tp, 0x15, 0x0089);
14162 rtl8168_mdio_write(tp, 0x19, 0x9e00);
14163 rtl8168_mdio_write(tp, 0x15, 0x008a);
14164 rtl8168_mdio_write(tp, 0x19, 0x7d00);
14165 rtl8168_mdio_write(tp, 0x15, 0x008b);
14166 rtl8168_mdio_write(tp, 0x19, 0x5800);
14167 rtl8168_mdio_write(tp, 0x15, 0x008c);
14168 rtl8168_mdio_write(tp, 0x19, 0x63c8);
14169 rtl8168_mdio_write(tp, 0x15, 0x008d);
14170 rtl8168_mdio_write(tp, 0x19, 0x63d8);
14171 rtl8168_mdio_write(tp, 0x15, 0x008e);
14172 rtl8168_mdio_write(tp, 0x19, 0x66a0);
14173 rtl8168_mdio_write(tp, 0x15, 0x008f);
14174 rtl8168_mdio_write(tp, 0x19, 0x8300);
14175 rtl8168_mdio_write(tp, 0x15, 0x0090);
14176 rtl8168_mdio_write(tp, 0x19, 0x7ff0);
14177 rtl8168_mdio_write(tp, 0x15, 0x0091);
14178 rtl8168_mdio_write(tp, 0x19, 0x74f0);
14179 rtl8168_mdio_write(tp, 0x15, 0x0092);
14180 rtl8168_mdio_write(tp, 0x19, 0x3006);
14181 rtl8168_mdio_write(tp, 0x15, 0x0093);
14182 rtl8168_mdio_write(tp, 0x19, 0x0000);
14183 rtl8168_mdio_write(tp, 0x15, 0x0094);
14184 rtl8168_mdio_write(tp, 0x19, 0x0000);
14185 rtl8168_mdio_write(tp, 0x15, 0x0095);
14186 rtl8168_mdio_write(tp, 0x19, 0x0000);
14187 rtl8168_mdio_write(tp, 0x15, 0x0096);
14188 rtl8168_mdio_write(tp, 0x19, 0x0000);
14189 rtl8168_mdio_write(tp, 0x15, 0x0097);
14190 rtl8168_mdio_write(tp, 0x19, 0x4803);
14191 rtl8168_mdio_write(tp, 0x15, 0x0098);
14192 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14193 rtl8168_mdio_write(tp, 0x15, 0x0099);
14194 rtl8168_mdio_write(tp, 0x19, 0x6c03);
14195 rtl8168_mdio_write(tp, 0x15, 0x009a);
14196 rtl8168_mdio_write(tp, 0x19, 0xa203);
14197 rtl8168_mdio_write(tp, 0x15, 0x009b);
14198 rtl8168_mdio_write(tp, 0x19, 0x64b1);
14199 rtl8168_mdio_write(tp, 0x15, 0x009c);
14200 rtl8168_mdio_write(tp, 0x19, 0x309e);
14201 rtl8168_mdio_write(tp, 0x15, 0x009d);
14202 rtl8168_mdio_write(tp, 0x19, 0x64b3);
14203 rtl8168_mdio_write(tp, 0x15, 0x009e);
14204 rtl8168_mdio_write(tp, 0x19, 0x4030);
14205 rtl8168_mdio_write(tp, 0x15, 0x009f);
14206 rtl8168_mdio_write(tp, 0x19, 0x440e);
14207 rtl8168_mdio_write(tp, 0x15, 0x00a0);
14208 rtl8168_mdio_write(tp, 0x19, 0x4020);
14209 rtl8168_mdio_write(tp, 0x15, 0x00a1);
14210 rtl8168_mdio_write(tp, 0x19, 0x4419);
14211 rtl8168_mdio_write(tp, 0x15, 0x00a2);
14212 rtl8168_mdio_write(tp, 0x19, 0x7801);
14213 rtl8168_mdio_write(tp, 0x15, 0x00a3);
14214 rtl8168_mdio_write(tp, 0x19, 0xc520);
14215 rtl8168_mdio_write(tp, 0x15, 0x00a4);
14216 rtl8168_mdio_write(tp, 0x19, 0x000b);
14217 rtl8168_mdio_write(tp, 0x15, 0x00a5);
14218 rtl8168_mdio_write(tp, 0x19, 0x4020);
14219 rtl8168_mdio_write(tp, 0x15, 0x00a6);
14220 rtl8168_mdio_write(tp, 0x19, 0x7800);
14221 rtl8168_mdio_write(tp, 0x15, 0x00a7);
14222 rtl8168_mdio_write(tp, 0x19, 0x58a4);
14223 rtl8168_mdio_write(tp, 0x15, 0x00a8);
14224 rtl8168_mdio_write(tp, 0x19, 0x63da);
14225 rtl8168_mdio_write(tp, 0x15, 0x00a9);
14226 rtl8168_mdio_write(tp, 0x19, 0x5cb0);
14227 rtl8168_mdio_write(tp, 0x15, 0x00aa);
14228 rtl8168_mdio_write(tp, 0x19, 0x7d00);
14229 rtl8168_mdio_write(tp, 0x15, 0x00ab);
14230 rtl8168_mdio_write(tp, 0x19, 0x72b0);
14231 rtl8168_mdio_write(tp, 0x15, 0x00ac);
14232 rtl8168_mdio_write(tp, 0x19, 0x7f00);
14233 rtl8168_mdio_write(tp, 0x15, 0x00ad);
14234 rtl8168_mdio_write(tp, 0x19, 0x70b0);
14235 rtl8168_mdio_write(tp, 0x15, 0x00ae);
14236 rtl8168_mdio_write(tp, 0x19, 0x30b8);
14237 rtl8168_mdio_write(tp, 0x15, 0x00AF);
14238 rtl8168_mdio_write(tp, 0x19, 0x4060);
14239 rtl8168_mdio_write(tp, 0x15, 0x00B0);
14240 rtl8168_mdio_write(tp, 0x19, 0x7800);
14241 rtl8168_mdio_write(tp, 0x15, 0x00B1);
14242 rtl8168_mdio_write(tp, 0x19, 0x7e00);
14243 rtl8168_mdio_write(tp, 0x15, 0x00B2);
14244 rtl8168_mdio_write(tp, 0x19, 0x72B0);
14245 rtl8168_mdio_write(tp, 0x15, 0x00B3);
14246 rtl8168_mdio_write(tp, 0x19, 0x7F00);
14247 rtl8168_mdio_write(tp, 0x15, 0x00B4);
14248 rtl8168_mdio_write(tp, 0x19, 0x73B0);
14249 rtl8168_mdio_write(tp, 0x15, 0x00b5);
14250 rtl8168_mdio_write(tp, 0x19, 0x58a0);
14251 rtl8168_mdio_write(tp, 0x15, 0x00b6);
14252 rtl8168_mdio_write(tp, 0x19, 0x63d2);
14253 rtl8168_mdio_write(tp, 0x15, 0x00b7);
14254 rtl8168_mdio_write(tp, 0x19, 0x5c00);
14255 rtl8168_mdio_write(tp, 0x15, 0x00b8);
14256 rtl8168_mdio_write(tp, 0x19, 0x5780);
14257 rtl8168_mdio_write(tp, 0x15, 0x00b9);
14258 rtl8168_mdio_write(tp, 0x19, 0xb60d);
14259 rtl8168_mdio_write(tp, 0x15, 0x00ba);
14260 rtl8168_mdio_write(tp, 0x19, 0x9bff);
14261 rtl8168_mdio_write(tp, 0x15, 0x00bb);
14262 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14263 rtl8168_mdio_write(tp, 0x15, 0x00bc);
14264 rtl8168_mdio_write(tp, 0x19, 0x6001);
14265 rtl8168_mdio_write(tp, 0x15, 0x00bd);
14266 rtl8168_mdio_write(tp, 0x19, 0xc020);
14267 rtl8168_mdio_write(tp, 0x15, 0x00be);
14268 rtl8168_mdio_write(tp, 0x19, 0x002b);
14269 rtl8168_mdio_write(tp, 0x15, 0x00bf);
14270 rtl8168_mdio_write(tp, 0x19, 0xc137);
14271 rtl8168_mdio_write(tp, 0x15, 0x00c0);
14272 rtl8168_mdio_write(tp, 0x19, 0x0006);
14273 rtl8168_mdio_write(tp, 0x15, 0x00c1);
14274 rtl8168_mdio_write(tp, 0x19, 0x9af8);
14275 rtl8168_mdio_write(tp, 0x15, 0x00c2);
14276 rtl8168_mdio_write(tp, 0x19, 0x30c6);
14277 rtl8168_mdio_write(tp, 0x15, 0x00c3);
14278 rtl8168_mdio_write(tp, 0x19, 0x0000);
14279 rtl8168_mdio_write(tp, 0x15, 0x00c4);
14280 rtl8168_mdio_write(tp, 0x19, 0x0000);
14281 rtl8168_mdio_write(tp, 0x15, 0x00c5);
14282 rtl8168_mdio_write(tp, 0x19, 0x0000);
14283 rtl8168_mdio_write(tp, 0x15, 0x00c6);
14284 rtl8168_mdio_write(tp, 0x19, 0x7d00);
14285 rtl8168_mdio_write(tp, 0x15, 0x00c7);
14286 rtl8168_mdio_write(tp, 0x19, 0x70b0);
14287 rtl8168_mdio_write(tp, 0x15, 0x00c8);
14288 rtl8168_mdio_write(tp, 0x19, 0x4400);
14289 rtl8168_mdio_write(tp, 0x15, 0x00c9);
14290 rtl8168_mdio_write(tp, 0x19, 0x4804);
14291 rtl8168_mdio_write(tp, 0x15, 0x00ca);
14292 rtl8168_mdio_write(tp, 0x19, 0x7c80);
14293 rtl8168_mdio_write(tp, 0x15, 0x00cb);
14294 rtl8168_mdio_write(tp, 0x19, 0x5c80);
14295 rtl8168_mdio_write(tp, 0x15, 0x00cc);
14296 rtl8168_mdio_write(tp, 0x19, 0x4010);
14297 rtl8168_mdio_write(tp, 0x15, 0x00cd);
14298 rtl8168_mdio_write(tp, 0x19, 0x4415);
14299 rtl8168_mdio_write(tp, 0x15, 0x00ce);
14300 rtl8168_mdio_write(tp, 0x19, 0x9b00);
14301 rtl8168_mdio_write(tp, 0x15, 0x00cf);
14302 rtl8168_mdio_write(tp, 0x19, 0x7f00);
14303 rtl8168_mdio_write(tp, 0x15, 0x00d0);
14304 rtl8168_mdio_write(tp, 0x19, 0x70b0);
14305 rtl8168_mdio_write(tp, 0x15, 0x00d1);
14306 rtl8168_mdio_write(tp, 0x19, 0x3177);
14307 rtl8168_mdio_write(tp, 0x15, 0x00d2);
14308 rtl8168_mdio_write(tp, 0x19, 0x0000);
14309 rtl8168_mdio_write(tp, 0x15, 0x00d3);
14310 rtl8168_mdio_write(tp, 0x19, 0x0000);
14311 rtl8168_mdio_write(tp, 0x15, 0x00d4);
14312 rtl8168_mdio_write(tp, 0x19, 0x0000);
14313 rtl8168_mdio_write(tp, 0x15, 0x00d5);
14314 rtl8168_mdio_write(tp, 0x19, 0x4808);
14315 rtl8168_mdio_write(tp, 0x15, 0x00d6);
14316 rtl8168_mdio_write(tp, 0x19, 0x4007);
14317 rtl8168_mdio_write(tp, 0x15, 0x00d7);
14318 rtl8168_mdio_write(tp, 0x19, 0x4420);
14319 rtl8168_mdio_write(tp, 0x15, 0x00d8);
14320 rtl8168_mdio_write(tp, 0x19, 0x63d8);
14321 rtl8168_mdio_write(tp, 0x15, 0x00d9);
14322 rtl8168_mdio_write(tp, 0x19, 0xb608);
14323 rtl8168_mdio_write(tp, 0x15, 0x00da);
14324 rtl8168_mdio_write(tp, 0x19, 0xbcbd);
14325 rtl8168_mdio_write(tp, 0x15, 0x00db);
14326 rtl8168_mdio_write(tp, 0x19, 0xc60b);
14327 rtl8168_mdio_write(tp, 0x15, 0x00dc);
14328 rtl8168_mdio_write(tp, 0x19, 0x00fd);
14329 rtl8168_mdio_write(tp, 0x15, 0x00dd);
14330 rtl8168_mdio_write(tp, 0x19, 0x30e1);
14331 rtl8168_mdio_write(tp, 0x15, 0x00de);
14332 rtl8168_mdio_write(tp, 0x19, 0x0000);
14333 rtl8168_mdio_write(tp, 0x15, 0x00df);
14334 rtl8168_mdio_write(tp, 0x19, 0x0000);
14335 rtl8168_mdio_write(tp, 0x15, 0x00e0);
14336 rtl8168_mdio_write(tp, 0x19, 0x0000);
14337 rtl8168_mdio_write(tp, 0x15, 0x00e1);
14338 rtl8168_mdio_write(tp, 0x19, 0x4809);
14339 rtl8168_mdio_write(tp, 0x15, 0x00e2);
14340 rtl8168_mdio_write(tp, 0x19, 0x7e40);
14341 rtl8168_mdio_write(tp, 0x15, 0x00e3);
14342 rtl8168_mdio_write(tp, 0x19, 0x5a40);
14343 rtl8168_mdio_write(tp, 0x15, 0x00e4);
14344 rtl8168_mdio_write(tp, 0x19, 0x305a);
14345 rtl8168_mdio_write(tp, 0x15, 0x00e5);
14346 rtl8168_mdio_write(tp, 0x19, 0x0000);
14347 rtl8168_mdio_write(tp, 0x15, 0x00e6);
14348 rtl8168_mdio_write(tp, 0x19, 0x0000);
14349 rtl8168_mdio_write(tp, 0x15, 0x00e7);
14350 rtl8168_mdio_write(tp, 0x19, 0x0000);
14351 rtl8168_mdio_write(tp, 0x15, 0x00e8);
14352 rtl8168_mdio_write(tp, 0x19, 0x0000);
14353 rtl8168_mdio_write(tp, 0x15, 0x00e9);
14354 rtl8168_mdio_write(tp, 0x19, 0x480a);
14355 rtl8168_mdio_write(tp, 0x15, 0x00ea);
14356 rtl8168_mdio_write(tp, 0x19, 0x5820);
14357 rtl8168_mdio_write(tp, 0x15, 0x00eb);
14358 rtl8168_mdio_write(tp, 0x19, 0x6c03);
14359 rtl8168_mdio_write(tp, 0x15, 0x00ec);
14360 rtl8168_mdio_write(tp, 0x19, 0xb60a);
14361 rtl8168_mdio_write(tp, 0x15, 0x00ed);
14362 rtl8168_mdio_write(tp, 0x19, 0xda07);
14363 rtl8168_mdio_write(tp, 0x15, 0x00ee);
14364 rtl8168_mdio_write(tp, 0x19, 0x0008);
14365 rtl8168_mdio_write(tp, 0x15, 0x00ef);
14366 rtl8168_mdio_write(tp, 0x19, 0xc60b);
14367 rtl8168_mdio_write(tp, 0x15, 0x00f0);
14368 rtl8168_mdio_write(tp, 0x19, 0x00fc);
14369 rtl8168_mdio_write(tp, 0x15, 0x00f1);
14370 rtl8168_mdio_write(tp, 0x19, 0x30f6);
14371 rtl8168_mdio_write(tp, 0x15, 0x00f2);
14372 rtl8168_mdio_write(tp, 0x19, 0x0000);
14373 rtl8168_mdio_write(tp, 0x15, 0x00f3);
14374 rtl8168_mdio_write(tp, 0x19, 0x0000);
14375 rtl8168_mdio_write(tp, 0x15, 0x00f4);
14376 rtl8168_mdio_write(tp, 0x19, 0x0000);
14377 rtl8168_mdio_write(tp, 0x15, 0x00f5);
14378 rtl8168_mdio_write(tp, 0x19, 0x0000);
14379 rtl8168_mdio_write(tp, 0x15, 0x00f6);
14380 rtl8168_mdio_write(tp, 0x19, 0x4408);
14381 rtl8168_mdio_write(tp, 0x15, 0x00f7);
14382 rtl8168_mdio_write(tp, 0x19, 0x480b);
14383 rtl8168_mdio_write(tp, 0x15, 0x00f8);
14384 rtl8168_mdio_write(tp, 0x19, 0x6f03);
14385 rtl8168_mdio_write(tp, 0x15, 0x00f9);
14386 rtl8168_mdio_write(tp, 0x19, 0x405f);
14387 rtl8168_mdio_write(tp, 0x15, 0x00fa);
14388 rtl8168_mdio_write(tp, 0x19, 0x4448);
14389 rtl8168_mdio_write(tp, 0x15, 0x00fb);
14390 rtl8168_mdio_write(tp, 0x19, 0x4020);
14391 rtl8168_mdio_write(tp, 0x15, 0x00fc);
14392 rtl8168_mdio_write(tp, 0x19, 0x4468);
14393 rtl8168_mdio_write(tp, 0x15, 0x00fd);
14394 rtl8168_mdio_write(tp, 0x19, 0x9c03);
14395 rtl8168_mdio_write(tp, 0x15, 0x00fe);
14396 rtl8168_mdio_write(tp, 0x19, 0x6f07);
14397 rtl8168_mdio_write(tp, 0x15, 0x00ff);
14398 rtl8168_mdio_write(tp, 0x19, 0x58a0);
14399 rtl8168_mdio_write(tp, 0x15, 0x0100);
14400 rtl8168_mdio_write(tp, 0x19, 0xd6d1);
14401 rtl8168_mdio_write(tp, 0x15, 0x0101);
14402 rtl8168_mdio_write(tp, 0x19, 0x0004);
14403 rtl8168_mdio_write(tp, 0x15, 0x0102);
14404 rtl8168_mdio_write(tp, 0x19, 0xc137);
14405 rtl8168_mdio_write(tp, 0x15, 0x0103);
14406 rtl8168_mdio_write(tp, 0x19, 0x0002);
14407 rtl8168_mdio_write(tp, 0x15, 0x0104);
14408 rtl8168_mdio_write(tp, 0x19, 0xa0e5);
14409 rtl8168_mdio_write(tp, 0x15, 0x0105);
14410 rtl8168_mdio_write(tp, 0x19, 0x9df8);
14411 rtl8168_mdio_write(tp, 0x15, 0x0106);
14412 rtl8168_mdio_write(tp, 0x19, 0x30c6);
14413 rtl8168_mdio_write(tp, 0x15, 0x0107);
14414 rtl8168_mdio_write(tp, 0x19, 0x0000);
14415 rtl8168_mdio_write(tp, 0x15, 0x0108);
14416 rtl8168_mdio_write(tp, 0x19, 0x0000);
14417 rtl8168_mdio_write(tp, 0x15, 0x0109);
14418 rtl8168_mdio_write(tp, 0x19, 0x0000);
14419 rtl8168_mdio_write(tp, 0x15, 0x010a);
14420 rtl8168_mdio_write(tp, 0x19, 0x0000);
14421 rtl8168_mdio_write(tp, 0x15, 0x010b);
14422 rtl8168_mdio_write(tp, 0x19, 0x4808);
14423 rtl8168_mdio_write(tp, 0x15, 0x010c);
14424 rtl8168_mdio_write(tp, 0x19, 0xc32d);
14425 rtl8168_mdio_write(tp, 0x15, 0x010d);
14426 rtl8168_mdio_write(tp, 0x19, 0x0003);
14427 rtl8168_mdio_write(tp, 0x15, 0x010e);
14428 rtl8168_mdio_write(tp, 0x19, 0xc8b3);
14429 rtl8168_mdio_write(tp, 0x15, 0x010f);
14430 rtl8168_mdio_write(tp, 0x19, 0x00fc);
14431 rtl8168_mdio_write(tp, 0x15, 0x0110);
14432 rtl8168_mdio_write(tp, 0x19, 0x4400);
14433 rtl8168_mdio_write(tp, 0x15, 0x0111);
14434 rtl8168_mdio_write(tp, 0x19, 0x3116);
14435 rtl8168_mdio_write(tp, 0x15, 0x0112);
14436 rtl8168_mdio_write(tp, 0x19, 0x0000);
14437 rtl8168_mdio_write(tp, 0x15, 0x0113);
14438 rtl8168_mdio_write(tp, 0x19, 0x0000);
14439 rtl8168_mdio_write(tp, 0x15, 0x0114);
14440 rtl8168_mdio_write(tp, 0x19, 0x0000);
14441 rtl8168_mdio_write(tp, 0x15, 0x0115);
14442 rtl8168_mdio_write(tp, 0x19, 0x0000);
14443 rtl8168_mdio_write(tp, 0x15, 0x0116);
14444 rtl8168_mdio_write(tp, 0x19, 0x4803);
14445 rtl8168_mdio_write(tp, 0x15, 0x0117);
14446 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14447 rtl8168_mdio_write(tp, 0x15, 0x0118);
14448 rtl8168_mdio_write(tp, 0x19, 0x6c02);
14449 rtl8168_mdio_write(tp, 0x15, 0x0119);
14450 rtl8168_mdio_write(tp, 0x19, 0x7c04);
14451 rtl8168_mdio_write(tp, 0x15, 0x011a);
14452 rtl8168_mdio_write(tp, 0x19, 0x6000);
14453 rtl8168_mdio_write(tp, 0x15, 0x011b);
14454 rtl8168_mdio_write(tp, 0x19, 0x5cf7);
14455 rtl8168_mdio_write(tp, 0x15, 0x011c);
14456 rtl8168_mdio_write(tp, 0x19, 0x7c2a);
14457 rtl8168_mdio_write(tp, 0x15, 0x011d);
14458 rtl8168_mdio_write(tp, 0x19, 0x5800);
14459 rtl8168_mdio_write(tp, 0x15, 0x011e);
14460 rtl8168_mdio_write(tp, 0x19, 0x5400);
14461 rtl8168_mdio_write(tp, 0x15, 0x011f);
14462 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14463 rtl8168_mdio_write(tp, 0x15, 0x0120);
14464 rtl8168_mdio_write(tp, 0x19, 0x74f0);
14465 rtl8168_mdio_write(tp, 0x15, 0x0121);
14466 rtl8168_mdio_write(tp, 0x19, 0x4019);
14467 rtl8168_mdio_write(tp, 0x15, 0x0122);
14468 rtl8168_mdio_write(tp, 0x19, 0x440d);
14469 rtl8168_mdio_write(tp, 0x15, 0x0123);
14470 rtl8168_mdio_write(tp, 0x19, 0xb6c1);
14471 rtl8168_mdio_write(tp, 0x15, 0x0124);
14472 rtl8168_mdio_write(tp, 0x19, 0xc05b);
14473 rtl8168_mdio_write(tp, 0x15, 0x0125);
14474 rtl8168_mdio_write(tp, 0x19, 0x00bf);
14475 rtl8168_mdio_write(tp, 0x15, 0x0126);
14476 rtl8168_mdio_write(tp, 0x19, 0xc025);
14477 rtl8168_mdio_write(tp, 0x15, 0x0127);
14478 rtl8168_mdio_write(tp, 0x19, 0x00bd);
14479 rtl8168_mdio_write(tp, 0x15, 0x0128);
14480 rtl8168_mdio_write(tp, 0x19, 0xc603);
14481 rtl8168_mdio_write(tp, 0x15, 0x0129);
14482 rtl8168_mdio_write(tp, 0x19, 0x00bb);
14483 rtl8168_mdio_write(tp, 0x15, 0x012a);
14484 rtl8168_mdio_write(tp, 0x19, 0x8805);
14485 rtl8168_mdio_write(tp, 0x15, 0x012b);
14486 rtl8168_mdio_write(tp, 0x19, 0x7801);
14487 rtl8168_mdio_write(tp, 0x15, 0x012c);
14488 rtl8168_mdio_write(tp, 0x19, 0x4001);
14489 rtl8168_mdio_write(tp, 0x15, 0x012d);
14490 rtl8168_mdio_write(tp, 0x19, 0x7800);
14491 rtl8168_mdio_write(tp, 0x15, 0x012e);
14492 rtl8168_mdio_write(tp, 0x19, 0xa3dd);
14493 rtl8168_mdio_write(tp, 0x15, 0x012f);
14494 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14495 rtl8168_mdio_write(tp, 0x15, 0x0130);
14496 rtl8168_mdio_write(tp, 0x19, 0x6c03);
14497 rtl8168_mdio_write(tp, 0x15, 0x0131);
14498 rtl8168_mdio_write(tp, 0x19, 0x8407);
14499 rtl8168_mdio_write(tp, 0x15, 0x0132);
14500 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14501 rtl8168_mdio_write(tp, 0x15, 0x0133);
14502 rtl8168_mdio_write(tp, 0x19, 0x6c02);
14503 rtl8168_mdio_write(tp, 0x15, 0x0134);
14504 rtl8168_mdio_write(tp, 0x19, 0xd9b8);
14505 rtl8168_mdio_write(tp, 0x15, 0x0135);
14506 rtl8168_mdio_write(tp, 0x19, 0x0003);
14507 rtl8168_mdio_write(tp, 0x15, 0x0136);
14508 rtl8168_mdio_write(tp, 0x19, 0xc240);
14509 rtl8168_mdio_write(tp, 0x15, 0x0137);
14510 rtl8168_mdio_write(tp, 0x19, 0x0015);
14511 rtl8168_mdio_write(tp, 0x15, 0x0138);
14512 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14513 rtl8168_mdio_write(tp, 0x15, 0x0139);
14514 rtl8168_mdio_write(tp, 0x19, 0x6c02);
14515 rtl8168_mdio_write(tp, 0x15, 0x013a);
14516 rtl8168_mdio_write(tp, 0x19, 0x9ae9);
14517 rtl8168_mdio_write(tp, 0x15, 0x013b);
14518 rtl8168_mdio_write(tp, 0x19, 0x3140);
14519 rtl8168_mdio_write(tp, 0x15, 0x013c);
14520 rtl8168_mdio_write(tp, 0x19, 0x0000);
14521 rtl8168_mdio_write(tp, 0x15, 0x013d);
14522 rtl8168_mdio_write(tp, 0x19, 0x0000);
14523 rtl8168_mdio_write(tp, 0x15, 0x013e);
14524 rtl8168_mdio_write(tp, 0x19, 0x0000);
14525 rtl8168_mdio_write(tp, 0x15, 0x013f);
14526 rtl8168_mdio_write(tp, 0x19, 0x0000);
14527 rtl8168_mdio_write(tp, 0x15, 0x0140);
14528 rtl8168_mdio_write(tp, 0x19, 0x4807);
14529 rtl8168_mdio_write(tp, 0x15, 0x0141);
14530 rtl8168_mdio_write(tp, 0x19, 0x4004);
14531 rtl8168_mdio_write(tp, 0x15, 0x0142);
14532 rtl8168_mdio_write(tp, 0x19, 0x4410);
14533 rtl8168_mdio_write(tp, 0x15, 0x0143);
14534 rtl8168_mdio_write(tp, 0x19, 0x7c0c);
14535 rtl8168_mdio_write(tp, 0x15, 0x0144);
14536 rtl8168_mdio_write(tp, 0x19, 0x600c);
14537 rtl8168_mdio_write(tp, 0x15, 0x0145);
14538 rtl8168_mdio_write(tp, 0x19, 0x9b00);
14539 rtl8168_mdio_write(tp, 0x15, 0x0146);
14540 rtl8168_mdio_write(tp, 0x19, 0xa68f);
14541 rtl8168_mdio_write(tp, 0x15, 0x0147);
14542 rtl8168_mdio_write(tp, 0x19, 0x3116);
14543 rtl8168_mdio_write(tp, 0x15, 0x0148);
14544 rtl8168_mdio_write(tp, 0x19, 0x0000);
14545 rtl8168_mdio_write(tp, 0x15, 0x0149);
14546 rtl8168_mdio_write(tp, 0x19, 0x0000);
14547 rtl8168_mdio_write(tp, 0x15, 0x014a);
14548 rtl8168_mdio_write(tp, 0x19, 0x0000);
14549 rtl8168_mdio_write(tp, 0x15, 0x014b);
14550 rtl8168_mdio_write(tp, 0x19, 0x0000);
14551 rtl8168_mdio_write(tp, 0x15, 0x014c);
14552 rtl8168_mdio_write(tp, 0x19, 0x4804);
14553 rtl8168_mdio_write(tp, 0x15, 0x014d);
14554 rtl8168_mdio_write(tp, 0x19, 0x54c0);
14555 rtl8168_mdio_write(tp, 0x15, 0x014e);
14556 rtl8168_mdio_write(tp, 0x19, 0xb703);
14557 rtl8168_mdio_write(tp, 0x15, 0x014f);
14558 rtl8168_mdio_write(tp, 0x19, 0x5cff);
14559 rtl8168_mdio_write(tp, 0x15, 0x0150);
14560 rtl8168_mdio_write(tp, 0x19, 0x315f);
14561 rtl8168_mdio_write(tp, 0x15, 0x0151);
14562 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14563 rtl8168_mdio_write(tp, 0x15, 0x0152);
14564 rtl8168_mdio_write(tp, 0x19, 0x74f8);
14565 rtl8168_mdio_write(tp, 0x15, 0x0153);
14566 rtl8168_mdio_write(tp, 0x19, 0x6421);
14567 rtl8168_mdio_write(tp, 0x15, 0x0154);
14568 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14569 rtl8168_mdio_write(tp, 0x15, 0x0155);
14570 rtl8168_mdio_write(tp, 0x19, 0x6000);
14571 rtl8168_mdio_write(tp, 0x15, 0x0156);
14572 rtl8168_mdio_write(tp, 0x19, 0x4003);
14573 rtl8168_mdio_write(tp, 0x15, 0x0157);
14574 rtl8168_mdio_write(tp, 0x19, 0x4418);
14575 rtl8168_mdio_write(tp, 0x15, 0x0158);
14576 rtl8168_mdio_write(tp, 0x19, 0x9b00);
14577 rtl8168_mdio_write(tp, 0x15, 0x0159);
14578 rtl8168_mdio_write(tp, 0x19, 0x6461);
14579 rtl8168_mdio_write(tp, 0x15, 0x015a);
14580 rtl8168_mdio_write(tp, 0x19, 0x64e1);
14581 rtl8168_mdio_write(tp, 0x15, 0x015b);
14582 rtl8168_mdio_write(tp, 0x19, 0x7c20);
14583 rtl8168_mdio_write(tp, 0x15, 0x015c);
14584 rtl8168_mdio_write(tp, 0x19, 0x5820);
14585 rtl8168_mdio_write(tp, 0x15, 0x015d);
14586 rtl8168_mdio_write(tp, 0x19, 0x5ccf);
14587 rtl8168_mdio_write(tp, 0x15, 0x015e);
14588 rtl8168_mdio_write(tp, 0x19, 0x7050);
14589 rtl8168_mdio_write(tp, 0x15, 0x015f);
14590 rtl8168_mdio_write(tp, 0x19, 0xd9b8);
14591 rtl8168_mdio_write(tp, 0x15, 0x0160);
14592 rtl8168_mdio_write(tp, 0x19, 0x0008);
14593 rtl8168_mdio_write(tp, 0x15, 0x0161);
14594 rtl8168_mdio_write(tp, 0x19, 0xdab1);
14595 rtl8168_mdio_write(tp, 0x15, 0x0162);
14596 rtl8168_mdio_write(tp, 0x19, 0x0015);
14597 rtl8168_mdio_write(tp, 0x15, 0x0163);
14598 rtl8168_mdio_write(tp, 0x19, 0xc244);
14599 rtl8168_mdio_write(tp, 0x15, 0x0164);
14600 rtl8168_mdio_write(tp, 0x19, 0x0013);
14601 rtl8168_mdio_write(tp, 0x15, 0x0165);
14602 rtl8168_mdio_write(tp, 0x19, 0xc021);
14603 rtl8168_mdio_write(tp, 0x15, 0x0166);
14604 rtl8168_mdio_write(tp, 0x19, 0x00f9);
14605 rtl8168_mdio_write(tp, 0x15, 0x0167);
14606 rtl8168_mdio_write(tp, 0x19, 0x3177);
14607 rtl8168_mdio_write(tp, 0x15, 0x0168);
14608 rtl8168_mdio_write(tp, 0x19, 0x5cf7);
14609 rtl8168_mdio_write(tp, 0x15, 0x0169);
14610 rtl8168_mdio_write(tp, 0x19, 0x4010);
14611 rtl8168_mdio_write(tp, 0x15, 0x016a);
14612 rtl8168_mdio_write(tp, 0x19, 0x4428);
14613 rtl8168_mdio_write(tp, 0x15, 0x016b);
14614 rtl8168_mdio_write(tp, 0x19, 0x9c00);
14615 rtl8168_mdio_write(tp, 0x15, 0x016c);
14616 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14617 rtl8168_mdio_write(tp, 0x15, 0x016d);
14618 rtl8168_mdio_write(tp, 0x19, 0x6008);
14619 rtl8168_mdio_write(tp, 0x15, 0x016e);
14620 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14621 rtl8168_mdio_write(tp, 0x15, 0x016f);
14622 rtl8168_mdio_write(tp, 0x19, 0x74f0);
14623 rtl8168_mdio_write(tp, 0x15, 0x0170);
14624 rtl8168_mdio_write(tp, 0x19, 0x6461);
14625 rtl8168_mdio_write(tp, 0x15, 0x0171);
14626 rtl8168_mdio_write(tp, 0x19, 0x6421);
14627 rtl8168_mdio_write(tp, 0x15, 0x0172);
14628 rtl8168_mdio_write(tp, 0x19, 0x64a1);
14629 rtl8168_mdio_write(tp, 0x15, 0x0173);
14630 rtl8168_mdio_write(tp, 0x19, 0x3116);
14631 rtl8168_mdio_write(tp, 0x15, 0x0174);
14632 rtl8168_mdio_write(tp, 0x19, 0x0000);
14633 rtl8168_mdio_write(tp, 0x15, 0x0175);
14634 rtl8168_mdio_write(tp, 0x19, 0x0000);
14635 rtl8168_mdio_write(tp, 0x15, 0x0176);
14636 rtl8168_mdio_write(tp, 0x19, 0x0000);
14637 rtl8168_mdio_write(tp, 0x15, 0x0177);
14638 rtl8168_mdio_write(tp, 0x19, 0x4805);
14639 rtl8168_mdio_write(tp, 0x15, 0x0178);
14640 rtl8168_mdio_write(tp, 0x19, 0xa103);
14641 rtl8168_mdio_write(tp, 0x15, 0x0179);
14642 rtl8168_mdio_write(tp, 0x19, 0x7c02);
14643 rtl8168_mdio_write(tp, 0x15, 0x017a);
14644 rtl8168_mdio_write(tp, 0x19, 0x6002);
14645 rtl8168_mdio_write(tp, 0x15, 0x017b);
14646 rtl8168_mdio_write(tp, 0x19, 0x7e00);
14647 rtl8168_mdio_write(tp, 0x15, 0x017c);
14648 rtl8168_mdio_write(tp, 0x19, 0x5400);
14649 rtl8168_mdio_write(tp, 0x15, 0x017d);
14650 rtl8168_mdio_write(tp, 0x19, 0x7c6b);
14651 rtl8168_mdio_write(tp, 0x15, 0x017e);
14652 rtl8168_mdio_write(tp, 0x19, 0x5c63);
14653 rtl8168_mdio_write(tp, 0x15, 0x017f);
14654 rtl8168_mdio_write(tp, 0x19, 0x407d);
14655 rtl8168_mdio_write(tp, 0x15, 0x0180);
14656 rtl8168_mdio_write(tp, 0x19, 0xa602);
14657 rtl8168_mdio_write(tp, 0x15, 0x0181);
14658 rtl8168_mdio_write(tp, 0x19, 0x4001);
14659 rtl8168_mdio_write(tp, 0x15, 0x0182);
14660 rtl8168_mdio_write(tp, 0x19, 0x4420);
14661 rtl8168_mdio_write(tp, 0x15, 0x0183);
14662 rtl8168_mdio_write(tp, 0x19, 0x4020);
14663 rtl8168_mdio_write(tp, 0x15, 0x0184);
14664 rtl8168_mdio_write(tp, 0x19, 0x44a1);
14665 rtl8168_mdio_write(tp, 0x15, 0x0185);
14666 rtl8168_mdio_write(tp, 0x19, 0xd6e0);
14667 rtl8168_mdio_write(tp, 0x15, 0x0186);
14668 rtl8168_mdio_write(tp, 0x19, 0x0009);
14669 rtl8168_mdio_write(tp, 0x15, 0x0187);
14670 rtl8168_mdio_write(tp, 0x19, 0x9efe);
14671 rtl8168_mdio_write(tp, 0x15, 0x0188);
14672 rtl8168_mdio_write(tp, 0x19, 0x7c02);
14673 rtl8168_mdio_write(tp, 0x15, 0x0189);
14674 rtl8168_mdio_write(tp, 0x19, 0x6000);
14675 rtl8168_mdio_write(tp, 0x15, 0x018a);
14676 rtl8168_mdio_write(tp, 0x19, 0x9c00);
14677 rtl8168_mdio_write(tp, 0x15, 0x018b);
14678 rtl8168_mdio_write(tp, 0x19, 0x318f);
14679 rtl8168_mdio_write(tp, 0x15, 0x018c);
14680 rtl8168_mdio_write(tp, 0x19, 0x0000);
14681 rtl8168_mdio_write(tp, 0x15, 0x018d);
14682 rtl8168_mdio_write(tp, 0x19, 0x0000);
14683 rtl8168_mdio_write(tp, 0x15, 0x018e);
14684 rtl8168_mdio_write(tp, 0x19, 0x0000);
14685 rtl8168_mdio_write(tp, 0x15, 0x018f);
14686 rtl8168_mdio_write(tp, 0x19, 0x4806);
14687 rtl8168_mdio_write(tp, 0x15, 0x0190);
14688 rtl8168_mdio_write(tp, 0x19, 0x7c10);
14689 rtl8168_mdio_write(tp, 0x15, 0x0191);
14690 rtl8168_mdio_write(tp, 0x19, 0x5c10);
14691 rtl8168_mdio_write(tp, 0x15, 0x0192);
14692 rtl8168_mdio_write(tp, 0x19, 0x40fa);
14693 rtl8168_mdio_write(tp, 0x15, 0x0193);
14694 rtl8168_mdio_write(tp, 0x19, 0xa602);
14695 rtl8168_mdio_write(tp, 0x15, 0x0194);
14696 rtl8168_mdio_write(tp, 0x19, 0x4010);
14697 rtl8168_mdio_write(tp, 0x15, 0x0195);
14698 rtl8168_mdio_write(tp, 0x19, 0x4440);
14699 rtl8168_mdio_write(tp, 0x15, 0x0196);
14700 rtl8168_mdio_write(tp, 0x19, 0x9d00);
14701 rtl8168_mdio_write(tp, 0x15, 0x0197);
14702 rtl8168_mdio_write(tp, 0x19, 0x7c80);
14703 rtl8168_mdio_write(tp, 0x15, 0x0198);
14704 rtl8168_mdio_write(tp, 0x19, 0x6400);
14705 rtl8168_mdio_write(tp, 0x15, 0x0199);
14706 rtl8168_mdio_write(tp, 0x19, 0x4003);
14707 rtl8168_mdio_write(tp, 0x15, 0x019a);
14708 rtl8168_mdio_write(tp, 0x19, 0x4540);
14709 rtl8168_mdio_write(tp, 0x15, 0x019b);
14710 rtl8168_mdio_write(tp, 0x19, 0x7c08);
14711 rtl8168_mdio_write(tp, 0x15, 0x019c);
14712 rtl8168_mdio_write(tp, 0x19, 0x6008);
14713 rtl8168_mdio_write(tp, 0x15, 0x019d);
14714 rtl8168_mdio_write(tp, 0x19, 0x9f00);
14715 rtl8168_mdio_write(tp, 0x15, 0x019e);
14716 rtl8168_mdio_write(tp, 0x19, 0x7c40);
14717 rtl8168_mdio_write(tp, 0x15, 0x019f);
14718 rtl8168_mdio_write(tp, 0x19, 0x6400);
14719 rtl8168_mdio_write(tp, 0x15, 0x01a0);
14720 rtl8168_mdio_write(tp, 0x19, 0x7c80);
14721 rtl8168_mdio_write(tp, 0x15, 0x01a1);
14722 rtl8168_mdio_write(tp, 0x19, 0x6480);
14723 rtl8168_mdio_write(tp, 0x15, 0x01a2);
14724 rtl8168_mdio_write(tp, 0x19, 0x3140);
14725 rtl8168_mdio_write(tp, 0x15, 0x01a3);
14726 rtl8168_mdio_write(tp, 0x19, 0x0000);
14727 rtl8168_mdio_write(tp, 0x15, 0x01a4);
14728 rtl8168_mdio_write(tp, 0x19, 0x0000);
14729 rtl8168_mdio_write(tp, 0x15, 0x01a5);
14730 rtl8168_mdio_write(tp, 0x19, 0x0000);
14731 rtl8168_mdio_write(tp, 0x15, 0x01a6);
14732 rtl8168_mdio_write(tp, 0x19, 0x4400);
14733 rtl8168_mdio_write(tp, 0x15, 0x01a7);
14734 rtl8168_mdio_write(tp, 0x19, 0x7c0b);
14735 rtl8168_mdio_write(tp, 0x15, 0x01a8);
14736 rtl8168_mdio_write(tp, 0x19, 0x6c01);
14737 rtl8168_mdio_write(tp, 0x15, 0x01a9);
14738 rtl8168_mdio_write(tp, 0x19, 0x64a8);
14739 rtl8168_mdio_write(tp, 0x15, 0x01aa);
14740 rtl8168_mdio_write(tp, 0x19, 0x6800);
14741 rtl8168_mdio_write(tp, 0x15, 0x01ab);
14742 rtl8168_mdio_write(tp, 0x19, 0x5cf0);
14743 rtl8168_mdio_write(tp, 0x15, 0x01ac);
14744 rtl8168_mdio_write(tp, 0x19, 0x588f);
14745 rtl8168_mdio_write(tp, 0x15, 0x01ad);
14746 rtl8168_mdio_write(tp, 0x19, 0xb628);
14747 rtl8168_mdio_write(tp, 0x15, 0x01ae);
14748 rtl8168_mdio_write(tp, 0x19, 0xc053);
14749 rtl8168_mdio_write(tp, 0x15, 0x01af);
14750 rtl8168_mdio_write(tp, 0x19, 0x0026);
14751 rtl8168_mdio_write(tp, 0x15, 0x01b0);
14752 rtl8168_mdio_write(tp, 0x19, 0xc02d);
14753 rtl8168_mdio_write(tp, 0x15, 0x01b1);
14754 rtl8168_mdio_write(tp, 0x19, 0x0024);
14755 rtl8168_mdio_write(tp, 0x15, 0x01b2);
14756 rtl8168_mdio_write(tp, 0x19, 0xc603);
14757 rtl8168_mdio_write(tp, 0x15, 0x01b3);
14758 rtl8168_mdio_write(tp, 0x19, 0x0022);
14759 rtl8168_mdio_write(tp, 0x15, 0x01b4);
14760 rtl8168_mdio_write(tp, 0x19, 0x8cf9);
14761 rtl8168_mdio_write(tp, 0x15, 0x01b5);
14762 rtl8168_mdio_write(tp, 0x19, 0x31ba);
14763 rtl8168_mdio_write(tp, 0x15, 0x01b6);
14764 rtl8168_mdio_write(tp, 0x19, 0x0000);
14765 rtl8168_mdio_write(tp, 0x15, 0x01b7);
14766 rtl8168_mdio_write(tp, 0x19, 0x0000);
14767 rtl8168_mdio_write(tp, 0x15, 0x01b8);
14768 rtl8168_mdio_write(tp, 0x19, 0x0000);
14769 rtl8168_mdio_write(tp, 0x15, 0x01b9);
14770 rtl8168_mdio_write(tp, 0x19, 0x0000);
14771 rtl8168_mdio_write(tp, 0x15, 0x01ba);
14772 rtl8168_mdio_write(tp, 0x19, 0x4400);
14773 rtl8168_mdio_write(tp, 0x15, 0x01bb);
14774 rtl8168_mdio_write(tp, 0x19, 0x5420);
14775 rtl8168_mdio_write(tp, 0x15, 0x01bc);
14776 rtl8168_mdio_write(tp, 0x19, 0x4811);
14777 rtl8168_mdio_write(tp, 0x15, 0x01bd);
14778 rtl8168_mdio_write(tp, 0x19, 0x5000);
14779 rtl8168_mdio_write(tp, 0x15, 0x01be);
14780 rtl8168_mdio_write(tp, 0x19, 0x4801);
14781 rtl8168_mdio_write(tp, 0x15, 0x01bf);
14782 rtl8168_mdio_write(tp, 0x19, 0x6800);
14783 rtl8168_mdio_write(tp, 0x15, 0x01c0);
14784 rtl8168_mdio_write(tp, 0x19, 0x31f5);
14785 rtl8168_mdio_write(tp, 0x15, 0x01c1);
14786 rtl8168_mdio_write(tp, 0x19, 0xb614);
14787 rtl8168_mdio_write(tp, 0x15, 0x01c2);
14788 rtl8168_mdio_write(tp, 0x19, 0x8ce4);
14789 rtl8168_mdio_write(tp, 0x15, 0x01c3);
14790 rtl8168_mdio_write(tp, 0x19, 0xb30c);
14791 rtl8168_mdio_write(tp, 0x15, 0x01c4);
14792 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14793 rtl8168_mdio_write(tp, 0x15, 0x01c5);
14794 rtl8168_mdio_write(tp, 0x19, 0x6c02);
14795 rtl8168_mdio_write(tp, 0x15, 0x01c6);
14796 rtl8168_mdio_write(tp, 0x19, 0x8206);
14797 rtl8168_mdio_write(tp, 0x15, 0x01c7);
14798 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14799 rtl8168_mdio_write(tp, 0x15, 0x01c8);
14800 rtl8168_mdio_write(tp, 0x19, 0x6c00);
14801 rtl8168_mdio_write(tp, 0x15, 0x01c9);
14802 rtl8168_mdio_write(tp, 0x19, 0x7c04);
14803 rtl8168_mdio_write(tp, 0x15, 0x01ca);
14804 rtl8168_mdio_write(tp, 0x19, 0x7404);
14805 rtl8168_mdio_write(tp, 0x15, 0x01cb);
14806 rtl8168_mdio_write(tp, 0x19, 0x31c0);
14807 rtl8168_mdio_write(tp, 0x15, 0x01cc);
14808 rtl8168_mdio_write(tp, 0x19, 0x7c04);
14809 rtl8168_mdio_write(tp, 0x15, 0x01cd);
14810 rtl8168_mdio_write(tp, 0x19, 0x7400);
14811 rtl8168_mdio_write(tp, 0x15, 0x01ce);
14812 rtl8168_mdio_write(tp, 0x19, 0x31c0);
14813 rtl8168_mdio_write(tp, 0x15, 0x01cf);
14814 rtl8168_mdio_write(tp, 0x19, 0x8df1);
14815 rtl8168_mdio_write(tp, 0x15, 0x01d0);
14816 rtl8168_mdio_write(tp, 0x19, 0x3248);
14817 rtl8168_mdio_write(tp, 0x15, 0x01d1);
14818 rtl8168_mdio_write(tp, 0x19, 0x0000);
14819 rtl8168_mdio_write(tp, 0x15, 0x01d2);
14820 rtl8168_mdio_write(tp, 0x19, 0x0000);
14821 rtl8168_mdio_write(tp, 0x15, 0x01d3);
14822 rtl8168_mdio_write(tp, 0x19, 0x0000);
14823 rtl8168_mdio_write(tp, 0x15, 0x01d4);
14824 rtl8168_mdio_write(tp, 0x19, 0x0000);
14825 rtl8168_mdio_write(tp, 0x15, 0x01d5);
14826 rtl8168_mdio_write(tp, 0x19, 0x4400);
14827 rtl8168_mdio_write(tp, 0x15, 0x01d6);
14828 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14829 rtl8168_mdio_write(tp, 0x15, 0x01d7);
14830 rtl8168_mdio_write(tp, 0x19, 0x6c03);
14831 rtl8168_mdio_write(tp, 0x15, 0x01d8);
14832 rtl8168_mdio_write(tp, 0x19, 0x7670);
14833 rtl8168_mdio_write(tp, 0x15, 0x01d9);
14834 rtl8168_mdio_write(tp, 0x19, 0x4023);
14835 rtl8168_mdio_write(tp, 0x15, 0x01da);
14836 rtl8168_mdio_write(tp, 0x19, 0x4500);
14837 rtl8168_mdio_write(tp, 0x15, 0x01db);
14838 rtl8168_mdio_write(tp, 0x19, 0x4069);
14839 rtl8168_mdio_write(tp, 0x15, 0x01dc);
14840 rtl8168_mdio_write(tp, 0x19, 0x4580);
14841 rtl8168_mdio_write(tp, 0x15, 0x01dd);
14842 rtl8168_mdio_write(tp, 0x19, 0x9f00);
14843 rtl8168_mdio_write(tp, 0x15, 0x01de);
14844 rtl8168_mdio_write(tp, 0x19, 0xcff5);
14845 rtl8168_mdio_write(tp, 0x15, 0x01df);
14846 rtl8168_mdio_write(tp, 0x19, 0x00ff);
14847 rtl8168_mdio_write(tp, 0x15, 0x01e0);
14848 rtl8168_mdio_write(tp, 0x19, 0x76f0);
14849 rtl8168_mdio_write(tp, 0x15, 0x01e1);
14850 rtl8168_mdio_write(tp, 0x19, 0x4400);
14851 rtl8168_mdio_write(tp, 0x15, 0x01e2);
14852 rtl8168_mdio_write(tp, 0x19, 0x4023);
14853 rtl8168_mdio_write(tp, 0x15, 0x01e3);
14854 rtl8168_mdio_write(tp, 0x19, 0x4500);
14855 rtl8168_mdio_write(tp, 0x15, 0x01e4);
14856 rtl8168_mdio_write(tp, 0x19, 0x4069);
14857 rtl8168_mdio_write(tp, 0x15, 0x01e5);
14858 rtl8168_mdio_write(tp, 0x19, 0x4580);
14859 rtl8168_mdio_write(tp, 0x15, 0x01e6);
14860 rtl8168_mdio_write(tp, 0x19, 0x9f00);
14861 rtl8168_mdio_write(tp, 0x15, 0x01e7);
14862 rtl8168_mdio_write(tp, 0x19, 0xd0f5);
14863 rtl8168_mdio_write(tp, 0x15, 0x01e8);
14864 rtl8168_mdio_write(tp, 0x19, 0x00ff);
14865 rtl8168_mdio_write(tp, 0x15, 0x01e9);
14866 rtl8168_mdio_write(tp, 0x19, 0x4400);
14867 rtl8168_mdio_write(tp, 0x15, 0x01ea);
14868 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14869 rtl8168_mdio_write(tp, 0x15, 0x01eb);
14870 rtl8168_mdio_write(tp, 0x19, 0x6800);
14871 rtl8168_mdio_write(tp, 0x15, 0x01ec);
14872 rtl8168_mdio_write(tp, 0x19, 0x66a0);
14873 rtl8168_mdio_write(tp, 0x15, 0x01ed);
14874 rtl8168_mdio_write(tp, 0x19, 0x8300);
14875 rtl8168_mdio_write(tp, 0x15, 0x01ee);
14876 rtl8168_mdio_write(tp, 0x19, 0x74f0);
14877 rtl8168_mdio_write(tp, 0x15, 0x01ef);
14878 rtl8168_mdio_write(tp, 0x19, 0x3006);
14879 rtl8168_mdio_write(tp, 0x15, 0x01f0);
14880 rtl8168_mdio_write(tp, 0x19, 0x0000);
14881 rtl8168_mdio_write(tp, 0x15, 0x01f1);
14882 rtl8168_mdio_write(tp, 0x19, 0x0000);
14883 rtl8168_mdio_write(tp, 0x15, 0x01f2);
14884 rtl8168_mdio_write(tp, 0x19, 0x0000);
14885 rtl8168_mdio_write(tp, 0x15, 0x01f3);
14886 rtl8168_mdio_write(tp, 0x19, 0x0000);
14887 rtl8168_mdio_write(tp, 0x15, 0x01f4);
14888 rtl8168_mdio_write(tp, 0x19, 0x0000);
14889 rtl8168_mdio_write(tp, 0x15, 0x01f5);
14890 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14891 rtl8168_mdio_write(tp, 0x15, 0x01f6);
14892 rtl8168_mdio_write(tp, 0x19, 0x6c02);
14893 rtl8168_mdio_write(tp, 0x15, 0x01f7);
14894 rtl8168_mdio_write(tp, 0x19, 0x409d);
14895 rtl8168_mdio_write(tp, 0x15, 0x01f8);
14896 rtl8168_mdio_write(tp, 0x19, 0x7c87);
14897 rtl8168_mdio_write(tp, 0x15, 0x01f9);
14898 rtl8168_mdio_write(tp, 0x19, 0xae14);
14899 rtl8168_mdio_write(tp, 0x15, 0x01fa);
14900 rtl8168_mdio_write(tp, 0x19, 0x4400);
14901 rtl8168_mdio_write(tp, 0x15, 0x01fb);
14902 rtl8168_mdio_write(tp, 0x19, 0x7c40);
14903 rtl8168_mdio_write(tp, 0x15, 0x01fc);
14904 rtl8168_mdio_write(tp, 0x19, 0x6800);
14905 rtl8168_mdio_write(tp, 0x15, 0x01fd);
14906 rtl8168_mdio_write(tp, 0x19, 0x7801);
14907 rtl8168_mdio_write(tp, 0x15, 0x01fe);
14908 rtl8168_mdio_write(tp, 0x19, 0x980e);
14909 rtl8168_mdio_write(tp, 0x15, 0x01ff);
14910 rtl8168_mdio_write(tp, 0x19, 0x930c);
14911 rtl8168_mdio_write(tp, 0x15, 0x0200);
14912 rtl8168_mdio_write(tp, 0x19, 0x9206);
14913 rtl8168_mdio_write(tp, 0x15, 0x0201);
14914 rtl8168_mdio_write(tp, 0x19, 0x4002);
14915 rtl8168_mdio_write(tp, 0x15, 0x0202);
14916 rtl8168_mdio_write(tp, 0x19, 0x7800);
14917 rtl8168_mdio_write(tp, 0x15, 0x0203);
14918 rtl8168_mdio_write(tp, 0x19, 0x588f);
14919 rtl8168_mdio_write(tp, 0x15, 0x0204);
14920 rtl8168_mdio_write(tp, 0x19, 0x5520);
14921 rtl8168_mdio_write(tp, 0x15, 0x0205);
14922 rtl8168_mdio_write(tp, 0x19, 0x320c);
14923 rtl8168_mdio_write(tp, 0x15, 0x0206);
14924 rtl8168_mdio_write(tp, 0x19, 0x4000);
14925 rtl8168_mdio_write(tp, 0x15, 0x0207);
14926 rtl8168_mdio_write(tp, 0x19, 0x7800);
14927 rtl8168_mdio_write(tp, 0x15, 0x0208);
14928 rtl8168_mdio_write(tp, 0x19, 0x588d);
14929 rtl8168_mdio_write(tp, 0x15, 0x0209);
14930 rtl8168_mdio_write(tp, 0x19, 0x5500);
14931 rtl8168_mdio_write(tp, 0x15, 0x020a);
14932 rtl8168_mdio_write(tp, 0x19, 0x320c);
14933 rtl8168_mdio_write(tp, 0x15, 0x020b);
14934 rtl8168_mdio_write(tp, 0x19, 0x4002);
14935 rtl8168_mdio_write(tp, 0x15, 0x020c);
14936 rtl8168_mdio_write(tp, 0x19, 0x3220);
14937 rtl8168_mdio_write(tp, 0x15, 0x020d);
14938 rtl8168_mdio_write(tp, 0x19, 0x4480);
14939 rtl8168_mdio_write(tp, 0x15, 0x020e);
14940 rtl8168_mdio_write(tp, 0x19, 0x9e03);
14941 rtl8168_mdio_write(tp, 0x15, 0x020f);
14942 rtl8168_mdio_write(tp, 0x19, 0x7c40);
14943 rtl8168_mdio_write(tp, 0x15, 0x0210);
14944 rtl8168_mdio_write(tp, 0x19, 0x6840);
14945 rtl8168_mdio_write(tp, 0x15, 0x0211);
14946 rtl8168_mdio_write(tp, 0x19, 0x7801);
14947 rtl8168_mdio_write(tp, 0x15, 0x0212);
14948 rtl8168_mdio_write(tp, 0x19, 0x980e);
14949 rtl8168_mdio_write(tp, 0x15, 0x0213);
14950 rtl8168_mdio_write(tp, 0x19, 0x930c);
14951 rtl8168_mdio_write(tp, 0x15, 0x0214);
14952 rtl8168_mdio_write(tp, 0x19, 0x9206);
14953 rtl8168_mdio_write(tp, 0x15, 0x0215);
14954 rtl8168_mdio_write(tp, 0x19, 0x4000);
14955 rtl8168_mdio_write(tp, 0x15, 0x0216);
14956 rtl8168_mdio_write(tp, 0x19, 0x7800);
14957 rtl8168_mdio_write(tp, 0x15, 0x0217);
14958 rtl8168_mdio_write(tp, 0x19, 0x588f);
14959 rtl8168_mdio_write(tp, 0x15, 0x0218);
14960 rtl8168_mdio_write(tp, 0x19, 0x5520);
14961 rtl8168_mdio_write(tp, 0x15, 0x0219);
14962 rtl8168_mdio_write(tp, 0x19, 0x3220);
14963 rtl8168_mdio_write(tp, 0x15, 0x021a);
14964 rtl8168_mdio_write(tp, 0x19, 0x4002);
14965 rtl8168_mdio_write(tp, 0x15, 0x021b);
14966 rtl8168_mdio_write(tp, 0x19, 0x7800);
14967 rtl8168_mdio_write(tp, 0x15, 0x021c);
14968 rtl8168_mdio_write(tp, 0x19, 0x588d);
14969 rtl8168_mdio_write(tp, 0x15, 0x021d);
14970 rtl8168_mdio_write(tp, 0x19, 0x5540);
14971 rtl8168_mdio_write(tp, 0x15, 0x021e);
14972 rtl8168_mdio_write(tp, 0x19, 0x3220);
14973 rtl8168_mdio_write(tp, 0x15, 0x021f);
14974 rtl8168_mdio_write(tp, 0x19, 0x4000);
14975 rtl8168_mdio_write(tp, 0x15, 0x0220);
14976 rtl8168_mdio_write(tp, 0x19, 0x7800);
14977 rtl8168_mdio_write(tp, 0x15, 0x0221);
14978 rtl8168_mdio_write(tp, 0x19, 0x7c03);
14979 rtl8168_mdio_write(tp, 0x15, 0x0222);
14980 rtl8168_mdio_write(tp, 0x19, 0x6c00);
14981 rtl8168_mdio_write(tp, 0x15, 0x0223);
14982 rtl8168_mdio_write(tp, 0x19, 0x3231);
14983 rtl8168_mdio_write(tp, 0x15, 0x0224);
14984 rtl8168_mdio_write(tp, 0x19, 0xab06);
14985 rtl8168_mdio_write(tp, 0x15, 0x0225);
14986 rtl8168_mdio_write(tp, 0x19, 0xbf08);
14987 rtl8168_mdio_write(tp, 0x15, 0x0226);
14988 rtl8168_mdio_write(tp, 0x19, 0x4076);
14989 rtl8168_mdio_write(tp, 0x15, 0x0227);
14990 rtl8168_mdio_write(tp, 0x19, 0x7d07);
14991 rtl8168_mdio_write(tp, 0x15, 0x0228);
14992 rtl8168_mdio_write(tp, 0x19, 0x4502);
14993 rtl8168_mdio_write(tp, 0x15, 0x0229);
14994 rtl8168_mdio_write(tp, 0x19, 0x3231);
14995 rtl8168_mdio_write(tp, 0x15, 0x022a);
14996 rtl8168_mdio_write(tp, 0x19, 0x7d80);
14997 rtl8168_mdio_write(tp, 0x15, 0x022b);
14998 rtl8168_mdio_write(tp, 0x19, 0x5180);
14999 rtl8168_mdio_write(tp, 0x15, 0x022c);
15000 rtl8168_mdio_write(tp, 0x19, 0x322f);
15001 rtl8168_mdio_write(tp, 0x15, 0x022d);
15002 rtl8168_mdio_write(tp, 0x19, 0x7d80);
15003 rtl8168_mdio_write(tp, 0x15, 0x022e);
15004 rtl8168_mdio_write(tp, 0x19, 0x5000);
15005 rtl8168_mdio_write(tp, 0x15, 0x022f);
15006 rtl8168_mdio_write(tp, 0x19, 0x7d07);
15007 rtl8168_mdio_write(tp, 0x15, 0x0230);
15008 rtl8168_mdio_write(tp, 0x19, 0x4402);
15009 rtl8168_mdio_write(tp, 0x15, 0x0231);
15010 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15011 rtl8168_mdio_write(tp, 0x15, 0x0232);
15012 rtl8168_mdio_write(tp, 0x19, 0x6c02);
15013 rtl8168_mdio_write(tp, 0x15, 0x0233);
15014 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15015 rtl8168_mdio_write(tp, 0x15, 0x0234);
15016 rtl8168_mdio_write(tp, 0x19, 0xb309);
15017 rtl8168_mdio_write(tp, 0x15, 0x0235);
15018 rtl8168_mdio_write(tp, 0x19, 0xb204);
15019 rtl8168_mdio_write(tp, 0x15, 0x0236);
15020 rtl8168_mdio_write(tp, 0x19, 0xb105);
15021 rtl8168_mdio_write(tp, 0x15, 0x0237);
15022 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15023 rtl8168_mdio_write(tp, 0x15, 0x0238);
15024 rtl8168_mdio_write(tp, 0x19, 0x31c1);
15025 rtl8168_mdio_write(tp, 0x15, 0x0239);
15026 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15027 rtl8168_mdio_write(tp, 0x15, 0x023a);
15028 rtl8168_mdio_write(tp, 0x19, 0x3261);
15029 rtl8168_mdio_write(tp, 0x15, 0x023b);
15030 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15031 rtl8168_mdio_write(tp, 0x15, 0x023c);
15032 rtl8168_mdio_write(tp, 0x19, 0x3250);
15033 rtl8168_mdio_write(tp, 0x15, 0x023d);
15034 rtl8168_mdio_write(tp, 0x19, 0xb203);
15035 rtl8168_mdio_write(tp, 0x15, 0x023e);
15036 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15037 rtl8168_mdio_write(tp, 0x15, 0x023f);
15038 rtl8168_mdio_write(tp, 0x19, 0x327a);
15039 rtl8168_mdio_write(tp, 0x15, 0x0240);
15040 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15041 rtl8168_mdio_write(tp, 0x15, 0x0241);
15042 rtl8168_mdio_write(tp, 0x19, 0x3293);
15043 rtl8168_mdio_write(tp, 0x15, 0x0242);
15044 rtl8168_mdio_write(tp, 0x19, 0x0000);
15045 rtl8168_mdio_write(tp, 0x15, 0x0243);
15046 rtl8168_mdio_write(tp, 0x19, 0x0000);
15047 rtl8168_mdio_write(tp, 0x15, 0x0244);
15048 rtl8168_mdio_write(tp, 0x19, 0x0000);
15049 rtl8168_mdio_write(tp, 0x15, 0x0245);
15050 rtl8168_mdio_write(tp, 0x19, 0x0000);
15051 rtl8168_mdio_write(tp, 0x15, 0x0246);
15052 rtl8168_mdio_write(tp, 0x19, 0x0000);
15053 rtl8168_mdio_write(tp, 0x15, 0x0247);
15054 rtl8168_mdio_write(tp, 0x19, 0x32a3);
15055 rtl8168_mdio_write(tp, 0x15, 0x0248);
15056 rtl8168_mdio_write(tp, 0x19, 0x5520);
15057 rtl8168_mdio_write(tp, 0x15, 0x0249);
15058 rtl8168_mdio_write(tp, 0x19, 0x403d);
15059 rtl8168_mdio_write(tp, 0x15, 0x024a);
15060 rtl8168_mdio_write(tp, 0x19, 0x440c);
15061 rtl8168_mdio_write(tp, 0x15, 0x024b);
15062 rtl8168_mdio_write(tp, 0x19, 0x4812);
15063 rtl8168_mdio_write(tp, 0x15, 0x024c);
15064 rtl8168_mdio_write(tp, 0x19, 0x5001);
15065 rtl8168_mdio_write(tp, 0x15, 0x024d);
15066 rtl8168_mdio_write(tp, 0x19, 0x4802);
15067 rtl8168_mdio_write(tp, 0x15, 0x024e);
15068 rtl8168_mdio_write(tp, 0x19, 0x6880);
15069 rtl8168_mdio_write(tp, 0x15, 0x024f);
15070 rtl8168_mdio_write(tp, 0x19, 0x31f5);
15071 rtl8168_mdio_write(tp, 0x15, 0x0250);
15072 rtl8168_mdio_write(tp, 0x19, 0xb685);
15073 rtl8168_mdio_write(tp, 0x15, 0x0251);
15074 rtl8168_mdio_write(tp, 0x19, 0x801c);
15075 rtl8168_mdio_write(tp, 0x15, 0x0252);
15076 rtl8168_mdio_write(tp, 0x19, 0xbaf5);
15077 rtl8168_mdio_write(tp, 0x15, 0x0253);
15078 rtl8168_mdio_write(tp, 0x19, 0xc07c);
15079 rtl8168_mdio_write(tp, 0x15, 0x0254);
15080 rtl8168_mdio_write(tp, 0x19, 0x00fb);
15081 rtl8168_mdio_write(tp, 0x15, 0x0255);
15082 rtl8168_mdio_write(tp, 0x19, 0x325a);
15083 rtl8168_mdio_write(tp, 0x15, 0x0256);
15084 rtl8168_mdio_write(tp, 0x19, 0x0000);
15085 rtl8168_mdio_write(tp, 0x15, 0x0257);
15086 rtl8168_mdio_write(tp, 0x19, 0x0000);
15087 rtl8168_mdio_write(tp, 0x15, 0x0258);
15088 rtl8168_mdio_write(tp, 0x19, 0x0000);
15089 rtl8168_mdio_write(tp, 0x15, 0x0259);
15090 rtl8168_mdio_write(tp, 0x19, 0x0000);
15091 rtl8168_mdio_write(tp, 0x15, 0x025a);
15092 rtl8168_mdio_write(tp, 0x19, 0x481a);
15093 rtl8168_mdio_write(tp, 0x15, 0x025b);
15094 rtl8168_mdio_write(tp, 0x19, 0x5001);
15095 rtl8168_mdio_write(tp, 0x15, 0x025c);
15096 rtl8168_mdio_write(tp, 0x19, 0x401b);
15097 rtl8168_mdio_write(tp, 0x15, 0x025d);
15098 rtl8168_mdio_write(tp, 0x19, 0x480a);
15099 rtl8168_mdio_write(tp, 0x15, 0x025e);
15100 rtl8168_mdio_write(tp, 0x19, 0x4418);
15101 rtl8168_mdio_write(tp, 0x15, 0x025f);
15102 rtl8168_mdio_write(tp, 0x19, 0x6900);
15103 rtl8168_mdio_write(tp, 0x15, 0x0260);
15104 rtl8168_mdio_write(tp, 0x19, 0x31f5);
15105 rtl8168_mdio_write(tp, 0x15, 0x0261);
15106 rtl8168_mdio_write(tp, 0x19, 0xb64b);
15107 rtl8168_mdio_write(tp, 0x15, 0x0262);
15108 rtl8168_mdio_write(tp, 0x19, 0xdb00);
15109 rtl8168_mdio_write(tp, 0x15, 0x0263);
15110 rtl8168_mdio_write(tp, 0x19, 0x0048);
15111 rtl8168_mdio_write(tp, 0x15, 0x0264);
15112 rtl8168_mdio_write(tp, 0x19, 0xdb7d);
15113 rtl8168_mdio_write(tp, 0x15, 0x0265);
15114 rtl8168_mdio_write(tp, 0x19, 0x0002);
15115 rtl8168_mdio_write(tp, 0x15, 0x0266);
15116 rtl8168_mdio_write(tp, 0x19, 0xa0fa);
15117 rtl8168_mdio_write(tp, 0x15, 0x0267);
15118 rtl8168_mdio_write(tp, 0x19, 0x4408);
15119 rtl8168_mdio_write(tp, 0x15, 0x0268);
15120 rtl8168_mdio_write(tp, 0x19, 0x3248);
15121 rtl8168_mdio_write(tp, 0x15, 0x0269);
15122 rtl8168_mdio_write(tp, 0x19, 0x0000);
15123 rtl8168_mdio_write(tp, 0x15, 0x026a);
15124 rtl8168_mdio_write(tp, 0x19, 0x0000);
15125 rtl8168_mdio_write(tp, 0x15, 0x026b);
15126 rtl8168_mdio_write(tp, 0x19, 0x0000);
15127 rtl8168_mdio_write(tp, 0x15, 0x026c);
15128 rtl8168_mdio_write(tp, 0x19, 0x0000);
15129 rtl8168_mdio_write(tp, 0x15, 0x026d);
15130 rtl8168_mdio_write(tp, 0x19, 0xb806);
15131 rtl8168_mdio_write(tp, 0x15, 0x026e);
15132 rtl8168_mdio_write(tp, 0x19, 0x588d);
15133 rtl8168_mdio_write(tp, 0x15, 0x026f);
15134 rtl8168_mdio_write(tp, 0x19, 0x5500);
15135 rtl8168_mdio_write(tp, 0x15, 0x0270);
15136 rtl8168_mdio_write(tp, 0x19, 0x7801);
15137 rtl8168_mdio_write(tp, 0x15, 0x0271);
15138 rtl8168_mdio_write(tp, 0x19, 0x4002);
15139 rtl8168_mdio_write(tp, 0x15, 0x0272);
15140 rtl8168_mdio_write(tp, 0x19, 0x7800);
15141 rtl8168_mdio_write(tp, 0x15, 0x0273);
15142 rtl8168_mdio_write(tp, 0x19, 0x4814);
15143 rtl8168_mdio_write(tp, 0x15, 0x0274);
15144 rtl8168_mdio_write(tp, 0x19, 0x500b);
15145 rtl8168_mdio_write(tp, 0x15, 0x0275);
15146 rtl8168_mdio_write(tp, 0x19, 0x4804);
15147 rtl8168_mdio_write(tp, 0x15, 0x0276);
15148 rtl8168_mdio_write(tp, 0x19, 0x40c4);
15149 rtl8168_mdio_write(tp, 0x15, 0x0277);
15150 rtl8168_mdio_write(tp, 0x19, 0x4425);
15151 rtl8168_mdio_write(tp, 0x15, 0x0278);
15152 rtl8168_mdio_write(tp, 0x19, 0x6a00);
15153 rtl8168_mdio_write(tp, 0x15, 0x0279);
15154 rtl8168_mdio_write(tp, 0x19, 0x31f5);
15155 rtl8168_mdio_write(tp, 0x15, 0x027a);
15156 rtl8168_mdio_write(tp, 0x19, 0xb632);
15157 rtl8168_mdio_write(tp, 0x15, 0x027b);
15158 rtl8168_mdio_write(tp, 0x19, 0xdc03);
15159 rtl8168_mdio_write(tp, 0x15, 0x027c);
15160 rtl8168_mdio_write(tp, 0x19, 0x0027);
15161 rtl8168_mdio_write(tp, 0x15, 0x027d);
15162 rtl8168_mdio_write(tp, 0x19, 0x80fc);
15163 rtl8168_mdio_write(tp, 0x15, 0x027e);
15164 rtl8168_mdio_write(tp, 0x19, 0x3283);
15165 rtl8168_mdio_write(tp, 0x15, 0x027f);
15166 rtl8168_mdio_write(tp, 0x19, 0x0000);
15167 rtl8168_mdio_write(tp, 0x15, 0x0280);
15168 rtl8168_mdio_write(tp, 0x19, 0x0000);
15169 rtl8168_mdio_write(tp, 0x15, 0x0281);
15170 rtl8168_mdio_write(tp, 0x19, 0x0000);
15171 rtl8168_mdio_write(tp, 0x15, 0x0282);
15172 rtl8168_mdio_write(tp, 0x19, 0x0000);
15173 rtl8168_mdio_write(tp, 0x15, 0x0283);
15174 rtl8168_mdio_write(tp, 0x19, 0xb806);
15175 rtl8168_mdio_write(tp, 0x15, 0x0284);
15176 rtl8168_mdio_write(tp, 0x19, 0x588f);
15177 rtl8168_mdio_write(tp, 0x15, 0x0285);
15178 rtl8168_mdio_write(tp, 0x19, 0x5520);
15179 rtl8168_mdio_write(tp, 0x15, 0x0286);
15180 rtl8168_mdio_write(tp, 0x19, 0x7801);
15181 rtl8168_mdio_write(tp, 0x15, 0x0287);
15182 rtl8168_mdio_write(tp, 0x19, 0x4000);
15183 rtl8168_mdio_write(tp, 0x15, 0x0288);
15184 rtl8168_mdio_write(tp, 0x19, 0x7800);
15185 rtl8168_mdio_write(tp, 0x15, 0x0289);
15186 rtl8168_mdio_write(tp, 0x19, 0x4818);
15187 rtl8168_mdio_write(tp, 0x15, 0x028a);
15188 rtl8168_mdio_write(tp, 0x19, 0x5051);
15189 rtl8168_mdio_write(tp, 0x15, 0x028b);
15190 rtl8168_mdio_write(tp, 0x19, 0x4808);
15191 rtl8168_mdio_write(tp, 0x15, 0x028c);
15192 rtl8168_mdio_write(tp, 0x19, 0x4050);
15193 rtl8168_mdio_write(tp, 0x15, 0x028d);
15194 rtl8168_mdio_write(tp, 0x19, 0x4462);
15195 rtl8168_mdio_write(tp, 0x15, 0x028e);
15196 rtl8168_mdio_write(tp, 0x19, 0x40c4);
15197 rtl8168_mdio_write(tp, 0x15, 0x028f);
15198 rtl8168_mdio_write(tp, 0x19, 0x4473);
15199 rtl8168_mdio_write(tp, 0x15, 0x0290);
15200 rtl8168_mdio_write(tp, 0x19, 0x5041);
15201 rtl8168_mdio_write(tp, 0x15, 0x0291);
15202 rtl8168_mdio_write(tp, 0x19, 0x6b00);
15203 rtl8168_mdio_write(tp, 0x15, 0x0292);
15204 rtl8168_mdio_write(tp, 0x19, 0x31f5);
15205 rtl8168_mdio_write(tp, 0x15, 0x0293);
15206 rtl8168_mdio_write(tp, 0x19, 0xb619);
15207 rtl8168_mdio_write(tp, 0x15, 0x0294);
15208 rtl8168_mdio_write(tp, 0x19, 0x80d9);
15209 rtl8168_mdio_write(tp, 0x15, 0x0295);
15210 rtl8168_mdio_write(tp, 0x19, 0xbd06);
15211 rtl8168_mdio_write(tp, 0x15, 0x0296);
15212 rtl8168_mdio_write(tp, 0x19, 0xbb0d);
15213 rtl8168_mdio_write(tp, 0x15, 0x0297);
15214 rtl8168_mdio_write(tp, 0x19, 0xaf14);
15215 rtl8168_mdio_write(tp, 0x15, 0x0298);
15216 rtl8168_mdio_write(tp, 0x19, 0x8efa);
15217 rtl8168_mdio_write(tp, 0x15, 0x0299);
15218 rtl8168_mdio_write(tp, 0x19, 0x5049);
15219 rtl8168_mdio_write(tp, 0x15, 0x029a);
15220 rtl8168_mdio_write(tp, 0x19, 0x3248);
15221 rtl8168_mdio_write(tp, 0x15, 0x029b);
15222 rtl8168_mdio_write(tp, 0x19, 0x4c10);
15223 rtl8168_mdio_write(tp, 0x15, 0x029c);
15224 rtl8168_mdio_write(tp, 0x19, 0x44b0);
15225 rtl8168_mdio_write(tp, 0x15, 0x029d);
15226 rtl8168_mdio_write(tp, 0x19, 0x4c00);
15227 rtl8168_mdio_write(tp, 0x15, 0x029e);
15228 rtl8168_mdio_write(tp, 0x19, 0x3292);
15229 rtl8168_mdio_write(tp, 0x15, 0x029f);
15230 rtl8168_mdio_write(tp, 0x19, 0x0000);
15231 rtl8168_mdio_write(tp, 0x15, 0x02a0);
15232 rtl8168_mdio_write(tp, 0x19, 0x0000);
15233 rtl8168_mdio_write(tp, 0x15, 0x02a1);
15234 rtl8168_mdio_write(tp, 0x19, 0x0000);
15235 rtl8168_mdio_write(tp, 0x15, 0x02a2);
15236 rtl8168_mdio_write(tp, 0x19, 0x0000);
15237 rtl8168_mdio_write(tp, 0x15, 0x02a3);
15238 rtl8168_mdio_write(tp, 0x19, 0x481f);
15239 rtl8168_mdio_write(tp, 0x15, 0x02a4);
15240 rtl8168_mdio_write(tp, 0x19, 0x5005);
15241 rtl8168_mdio_write(tp, 0x15, 0x02a5);
15242 rtl8168_mdio_write(tp, 0x19, 0x480f);
15243 rtl8168_mdio_write(tp, 0x15, 0x02a6);
15244 rtl8168_mdio_write(tp, 0x19, 0xac00);
15245 rtl8168_mdio_write(tp, 0x15, 0x02a7);
15246 rtl8168_mdio_write(tp, 0x19, 0x31a6);
15247 rtl8168_mdio_write(tp, 0x15, 0x02a8);
15248 rtl8168_mdio_write(tp, 0x19, 0x0000);
15249 rtl8168_mdio_write(tp, 0x15, 0x02a9);
15250 rtl8168_mdio_write(tp, 0x19, 0x0000);
15251 rtl8168_mdio_write(tp, 0x15, 0x02aa);
15252 rtl8168_mdio_write(tp, 0x19, 0x0000);
15253 rtl8168_mdio_write(tp, 0x15, 0x02ab);
15254 rtl8168_mdio_write(tp, 0x19, 0x31ba);
15255 rtl8168_mdio_write(tp, 0x15, 0x02ac);
15256 rtl8168_mdio_write(tp, 0x19, 0x31d5);
15257 rtl8168_mdio_write(tp, 0x15, 0x02ad);
15258 rtl8168_mdio_write(tp, 0x19, 0x0000);
15259 rtl8168_mdio_write(tp, 0x15, 0x02ae);
15260 rtl8168_mdio_write(tp, 0x19, 0x5cf0);
15261 rtl8168_mdio_write(tp, 0x15, 0x02af);
15262 rtl8168_mdio_write(tp, 0x19, 0x588c);
15263 rtl8168_mdio_write(tp, 0x15, 0x02b0);
15264 rtl8168_mdio_write(tp, 0x19, 0x542f);
15265 rtl8168_mdio_write(tp, 0x15, 0x02b1);
15266 rtl8168_mdio_write(tp, 0x19, 0x7ffb);
15267 rtl8168_mdio_write(tp, 0x15, 0x02b2);
15268 rtl8168_mdio_write(tp, 0x19, 0x6ff8);
15269 rtl8168_mdio_write(tp, 0x15, 0x02b3);
15270 rtl8168_mdio_write(tp, 0x19, 0x64a4);
15271 rtl8168_mdio_write(tp, 0x15, 0x02b4);
15272 rtl8168_mdio_write(tp, 0x19, 0x64a0);
15273 rtl8168_mdio_write(tp, 0x15, 0x02b5);
15274 rtl8168_mdio_write(tp, 0x19, 0x6800);
15275 rtl8168_mdio_write(tp, 0x15, 0x02b6);
15276 rtl8168_mdio_write(tp, 0x19, 0x4400);
15277 rtl8168_mdio_write(tp, 0x15, 0x02b7);
15278 rtl8168_mdio_write(tp, 0x19, 0x4020);
15279 rtl8168_mdio_write(tp, 0x15, 0x02b8);
15280 rtl8168_mdio_write(tp, 0x19, 0x4480);
15281 rtl8168_mdio_write(tp, 0x15, 0x02b9);
15282 rtl8168_mdio_write(tp, 0x19, 0x9e00);
15283 rtl8168_mdio_write(tp, 0x15, 0x02ba);
15284 rtl8168_mdio_write(tp, 0x19, 0x4891);
15285 rtl8168_mdio_write(tp, 0x15, 0x02bb);
15286 rtl8168_mdio_write(tp, 0x19, 0x4cc0);
15287 rtl8168_mdio_write(tp, 0x15, 0x02bc);
15288 rtl8168_mdio_write(tp, 0x19, 0x4801);
15289 rtl8168_mdio_write(tp, 0x15, 0x02bd);
15290 rtl8168_mdio_write(tp, 0x19, 0xa609);
15291 rtl8168_mdio_write(tp, 0x15, 0x02be);
15292 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15293 rtl8168_mdio_write(tp, 0x15, 0x02bf);
15294 rtl8168_mdio_write(tp, 0x19, 0x004e);
15295 rtl8168_mdio_write(tp, 0x15, 0x02c0);
15296 rtl8168_mdio_write(tp, 0x19, 0x87fe);
15297 rtl8168_mdio_write(tp, 0x15, 0x02c1);
15298 rtl8168_mdio_write(tp, 0x19, 0x32c6);
15299 rtl8168_mdio_write(tp, 0x15, 0x02c2);
15300 rtl8168_mdio_write(tp, 0x19, 0x0000);
15301 rtl8168_mdio_write(tp, 0x15, 0x02c3);
15302 rtl8168_mdio_write(tp, 0x19, 0x0000);
15303 rtl8168_mdio_write(tp, 0x15, 0x02c4);
15304 rtl8168_mdio_write(tp, 0x19, 0x0000);
15305 rtl8168_mdio_write(tp, 0x15, 0x02c5);
15306 rtl8168_mdio_write(tp, 0x19, 0x0000);
15307 rtl8168_mdio_write(tp, 0x15, 0x02c6);
15308 rtl8168_mdio_write(tp, 0x19, 0x48b2);
15309 rtl8168_mdio_write(tp, 0x15, 0x02c7);
15310 rtl8168_mdio_write(tp, 0x19, 0x4020);
15311 rtl8168_mdio_write(tp, 0x15, 0x02c8);
15312 rtl8168_mdio_write(tp, 0x19, 0x4822);
15313 rtl8168_mdio_write(tp, 0x15, 0x02c9);
15314 rtl8168_mdio_write(tp, 0x19, 0x4488);
15315 rtl8168_mdio_write(tp, 0x15, 0x02ca);
15316 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15317 rtl8168_mdio_write(tp, 0x15, 0x02cb);
15318 rtl8168_mdio_write(tp, 0x19, 0x0042);
15319 rtl8168_mdio_write(tp, 0x15, 0x02cc);
15320 rtl8168_mdio_write(tp, 0x19, 0x8203);
15321 rtl8168_mdio_write(tp, 0x15, 0x02cd);
15322 rtl8168_mdio_write(tp, 0x19, 0x4cc8);
15323 rtl8168_mdio_write(tp, 0x15, 0x02ce);
15324 rtl8168_mdio_write(tp, 0x19, 0x32d0);
15325 rtl8168_mdio_write(tp, 0x15, 0x02cf);
15326 rtl8168_mdio_write(tp, 0x19, 0x4cc0);
15327 rtl8168_mdio_write(tp, 0x15, 0x02d0);
15328 rtl8168_mdio_write(tp, 0x19, 0xc4d4);
15329 rtl8168_mdio_write(tp, 0x15, 0x02d1);
15330 rtl8168_mdio_write(tp, 0x19, 0x00f9);
15331 rtl8168_mdio_write(tp, 0x15, 0x02d2);
15332 rtl8168_mdio_write(tp, 0x19, 0xa51a);
15333 rtl8168_mdio_write(tp, 0x15, 0x02d3);
15334 rtl8168_mdio_write(tp, 0x19, 0x32d9);
15335 rtl8168_mdio_write(tp, 0x15, 0x02d4);
15336 rtl8168_mdio_write(tp, 0x19, 0x0000);
15337 rtl8168_mdio_write(tp, 0x15, 0x02d5);
15338 rtl8168_mdio_write(tp, 0x19, 0x0000);
15339 rtl8168_mdio_write(tp, 0x15, 0x02d6);
15340 rtl8168_mdio_write(tp, 0x19, 0x0000);
15341 rtl8168_mdio_write(tp, 0x15, 0x02d7);
15342 rtl8168_mdio_write(tp, 0x19, 0x0000);
15343 rtl8168_mdio_write(tp, 0x15, 0x02d8);
15344 rtl8168_mdio_write(tp, 0x19, 0x0000);
15345 rtl8168_mdio_write(tp, 0x15, 0x02d9);
15346 rtl8168_mdio_write(tp, 0x19, 0x48b3);
15347 rtl8168_mdio_write(tp, 0x15, 0x02da);
15348 rtl8168_mdio_write(tp, 0x19, 0x4020);
15349 rtl8168_mdio_write(tp, 0x15, 0x02db);
15350 rtl8168_mdio_write(tp, 0x19, 0x4823);
15351 rtl8168_mdio_write(tp, 0x15, 0x02dc);
15352 rtl8168_mdio_write(tp, 0x19, 0x4410);
15353 rtl8168_mdio_write(tp, 0x15, 0x02dd);
15354 rtl8168_mdio_write(tp, 0x19, 0xb630);
15355 rtl8168_mdio_write(tp, 0x15, 0x02de);
15356 rtl8168_mdio_write(tp, 0x19, 0x7dc8);
15357 rtl8168_mdio_write(tp, 0x15, 0x02df);
15358 rtl8168_mdio_write(tp, 0x19, 0x8203);
15359 rtl8168_mdio_write(tp, 0x15, 0x02e0);
15360 rtl8168_mdio_write(tp, 0x19, 0x4c48);
15361 rtl8168_mdio_write(tp, 0x15, 0x02e1);
15362 rtl8168_mdio_write(tp, 0x19, 0x32e3);
15363 rtl8168_mdio_write(tp, 0x15, 0x02e2);
15364 rtl8168_mdio_write(tp, 0x19, 0x4c40);
15365 rtl8168_mdio_write(tp, 0x15, 0x02e3);
15366 rtl8168_mdio_write(tp, 0x19, 0x9bfa);
15367 rtl8168_mdio_write(tp, 0x15, 0x02e4);
15368 rtl8168_mdio_write(tp, 0x19, 0x84ca);
15369 rtl8168_mdio_write(tp, 0x15, 0x02e5);
15370 rtl8168_mdio_write(tp, 0x19, 0x85f8);
15371 rtl8168_mdio_write(tp, 0x15, 0x02e6);
15372 rtl8168_mdio_write(tp, 0x19, 0x32ec);
15373 rtl8168_mdio_write(tp, 0x15, 0x02e7);
15374 rtl8168_mdio_write(tp, 0x19, 0x0000);
15375 rtl8168_mdio_write(tp, 0x15, 0x02e8);
15376 rtl8168_mdio_write(tp, 0x19, 0x0000);
15377 rtl8168_mdio_write(tp, 0x15, 0x02e9);
15378 rtl8168_mdio_write(tp, 0x19, 0x0000);
15379 rtl8168_mdio_write(tp, 0x15, 0x02ea);
15380 rtl8168_mdio_write(tp, 0x19, 0x0000);
15381 rtl8168_mdio_write(tp, 0x15, 0x02eb);
15382 rtl8168_mdio_write(tp, 0x19, 0x0000);
15383 rtl8168_mdio_write(tp, 0x15, 0x02ec);
15384 rtl8168_mdio_write(tp, 0x19, 0x48d4);
15385 rtl8168_mdio_write(tp, 0x15, 0x02ed);
15386 rtl8168_mdio_write(tp, 0x19, 0x4020);
15387 rtl8168_mdio_write(tp, 0x15, 0x02ee);
15388 rtl8168_mdio_write(tp, 0x19, 0x4844);
15389 rtl8168_mdio_write(tp, 0x15, 0x02ef);
15390 rtl8168_mdio_write(tp, 0x19, 0x4420);
15391 rtl8168_mdio_write(tp, 0x15, 0x02f0);
15392 rtl8168_mdio_write(tp, 0x19, 0x6800);
15393 rtl8168_mdio_write(tp, 0x15, 0x02f1);
15394 rtl8168_mdio_write(tp, 0x19, 0x7dc0);
15395 rtl8168_mdio_write(tp, 0x15, 0x02f2);
15396 rtl8168_mdio_write(tp, 0x19, 0x4c40);
15397 rtl8168_mdio_write(tp, 0x15, 0x02f3);
15398 rtl8168_mdio_write(tp, 0x19, 0x7c0b);
15399 rtl8168_mdio_write(tp, 0x15, 0x02f4);
15400 rtl8168_mdio_write(tp, 0x19, 0x6c08);
15401 rtl8168_mdio_write(tp, 0x15, 0x02f5);
15402 rtl8168_mdio_write(tp, 0x19, 0x3311);
15403 rtl8168_mdio_write(tp, 0x15, 0x02f6);
15404 rtl8168_mdio_write(tp, 0x19, 0x9cfd);
15405 rtl8168_mdio_write(tp, 0x15, 0x02f7);
15406 rtl8168_mdio_write(tp, 0x19, 0xb616);
15407 rtl8168_mdio_write(tp, 0x15, 0x02f8);
15408 rtl8168_mdio_write(tp, 0x19, 0xc42b);
15409 rtl8168_mdio_write(tp, 0x15, 0x02f9);
15410 rtl8168_mdio_write(tp, 0x19, 0x00e0);
15411 rtl8168_mdio_write(tp, 0x15, 0x02fa);
15412 rtl8168_mdio_write(tp, 0x19, 0xc455);
15413 rtl8168_mdio_write(tp, 0x15, 0x02fb);
15414 rtl8168_mdio_write(tp, 0x19, 0x00b3);
15415 rtl8168_mdio_write(tp, 0x15, 0x02fc);
15416 rtl8168_mdio_write(tp, 0x19, 0xb20a);
15417 rtl8168_mdio_write(tp, 0x15, 0x02fd);
15418 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15419 rtl8168_mdio_write(tp, 0x15, 0x02fe);
15420 rtl8168_mdio_write(tp, 0x19, 0x6c02);
15421 rtl8168_mdio_write(tp, 0x15, 0x02ff);
15422 rtl8168_mdio_write(tp, 0x19, 0x8204);
15423 rtl8168_mdio_write(tp, 0x15, 0x0300);
15424 rtl8168_mdio_write(tp, 0x19, 0x7c04);
15425 rtl8168_mdio_write(tp, 0x15, 0x0301);
15426 rtl8168_mdio_write(tp, 0x19, 0x7404);
15427 rtl8168_mdio_write(tp, 0x15, 0x0302);
15428 rtl8168_mdio_write(tp, 0x19, 0x32f3);
15429 rtl8168_mdio_write(tp, 0x15, 0x0303);
15430 rtl8168_mdio_write(tp, 0x19, 0x7c04);
15431 rtl8168_mdio_write(tp, 0x15, 0x0304);
15432 rtl8168_mdio_write(tp, 0x19, 0x7400);
15433 rtl8168_mdio_write(tp, 0x15, 0x0305);
15434 rtl8168_mdio_write(tp, 0x19, 0x32f3);
15435 rtl8168_mdio_write(tp, 0x15, 0x0306);
15436 rtl8168_mdio_write(tp, 0x19, 0xefed);
15437 rtl8168_mdio_write(tp, 0x15, 0x0307);
15438 rtl8168_mdio_write(tp, 0x19, 0x3342);
15439 rtl8168_mdio_write(tp, 0x15, 0x0308);
15440 rtl8168_mdio_write(tp, 0x19, 0x0000);
15441 rtl8168_mdio_write(tp, 0x15, 0x0309);
15442 rtl8168_mdio_write(tp, 0x19, 0x0000);
15443 rtl8168_mdio_write(tp, 0x15, 0x030a);
15444 rtl8168_mdio_write(tp, 0x19, 0x0000);
15445 rtl8168_mdio_write(tp, 0x15, 0x030b);
15446 rtl8168_mdio_write(tp, 0x19, 0x0000);
15447 rtl8168_mdio_write(tp, 0x15, 0x030c);
15448 rtl8168_mdio_write(tp, 0x19, 0x0000);
15449 rtl8168_mdio_write(tp, 0x15, 0x030d);
15450 rtl8168_mdio_write(tp, 0x19, 0x3006);
15451 rtl8168_mdio_write(tp, 0x15, 0x030e);
15452 rtl8168_mdio_write(tp, 0x19, 0x0000);
15453 rtl8168_mdio_write(tp, 0x15, 0x030f);
15454 rtl8168_mdio_write(tp, 0x19, 0x0000);
15455 rtl8168_mdio_write(tp, 0x15, 0x0310);
15456 rtl8168_mdio_write(tp, 0x19, 0x0000);
15457 rtl8168_mdio_write(tp, 0x15, 0x0311);
15458 rtl8168_mdio_write(tp, 0x19, 0x7c08);
15459 rtl8168_mdio_write(tp, 0x15, 0x0312);
15460 rtl8168_mdio_write(tp, 0x19, 0xa207);
15461 rtl8168_mdio_write(tp, 0x15, 0x0313);
15462 rtl8168_mdio_write(tp, 0x19, 0x4c00);
15463 rtl8168_mdio_write(tp, 0x15, 0x0314);
15464 rtl8168_mdio_write(tp, 0x19, 0x3322);
15465 rtl8168_mdio_write(tp, 0x15, 0x0315);
15466 rtl8168_mdio_write(tp, 0x19, 0x4041);
15467 rtl8168_mdio_write(tp, 0x15, 0x0316);
15468 rtl8168_mdio_write(tp, 0x19, 0x7d07);
15469 rtl8168_mdio_write(tp, 0x15, 0x0317);
15470 rtl8168_mdio_write(tp, 0x19, 0x4502);
15471 rtl8168_mdio_write(tp, 0x15, 0x0318);
15472 rtl8168_mdio_write(tp, 0x19, 0x3322);
15473 rtl8168_mdio_write(tp, 0x15, 0x0319);
15474 rtl8168_mdio_write(tp, 0x19, 0x4c08);
15475 rtl8168_mdio_write(tp, 0x15, 0x031a);
15476 rtl8168_mdio_write(tp, 0x19, 0x3322);
15477 rtl8168_mdio_write(tp, 0x15, 0x031b);
15478 rtl8168_mdio_write(tp, 0x19, 0x7d80);
15479 rtl8168_mdio_write(tp, 0x15, 0x031c);
15480 rtl8168_mdio_write(tp, 0x19, 0x5180);
15481 rtl8168_mdio_write(tp, 0x15, 0x031d);
15482 rtl8168_mdio_write(tp, 0x19, 0x3320);
15483 rtl8168_mdio_write(tp, 0x15, 0x031e);
15484 rtl8168_mdio_write(tp, 0x19, 0x7d80);
15485 rtl8168_mdio_write(tp, 0x15, 0x031f);
15486 rtl8168_mdio_write(tp, 0x19, 0x5000);
15487 rtl8168_mdio_write(tp, 0x15, 0x0320);
15488 rtl8168_mdio_write(tp, 0x19, 0x7d07);
15489 rtl8168_mdio_write(tp, 0x15, 0x0321);
15490 rtl8168_mdio_write(tp, 0x19, 0x4402);
15491 rtl8168_mdio_write(tp, 0x15, 0x0322);
15492 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15493 rtl8168_mdio_write(tp, 0x15, 0x0323);
15494 rtl8168_mdio_write(tp, 0x19, 0x6c02);
15495 rtl8168_mdio_write(tp, 0x15, 0x0324);
15496 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15497 rtl8168_mdio_write(tp, 0x15, 0x0325);
15498 rtl8168_mdio_write(tp, 0x19, 0xb30c);
15499 rtl8168_mdio_write(tp, 0x15, 0x0326);
15500 rtl8168_mdio_write(tp, 0x19, 0xb206);
15501 rtl8168_mdio_write(tp, 0x15, 0x0327);
15502 rtl8168_mdio_write(tp, 0x19, 0xb103);
15503 rtl8168_mdio_write(tp, 0x15, 0x0328);
15504 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15505 rtl8168_mdio_write(tp, 0x15, 0x0329);
15506 rtl8168_mdio_write(tp, 0x19, 0x32f6);
15507 rtl8168_mdio_write(tp, 0x15, 0x032a);
15508 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15509 rtl8168_mdio_write(tp, 0x15, 0x032b);
15510 rtl8168_mdio_write(tp, 0x19, 0x3352);
15511 rtl8168_mdio_write(tp, 0x15, 0x032c);
15512 rtl8168_mdio_write(tp, 0x19, 0xb103);
15513 rtl8168_mdio_write(tp, 0x15, 0x032d);
15514 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15515 rtl8168_mdio_write(tp, 0x15, 0x032e);
15516 rtl8168_mdio_write(tp, 0x19, 0x336a);
15517 rtl8168_mdio_write(tp, 0x15, 0x032f);
15518 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15519 rtl8168_mdio_write(tp, 0x15, 0x0330);
15520 rtl8168_mdio_write(tp, 0x19, 0x3382);
15521 rtl8168_mdio_write(tp, 0x15, 0x0331);
15522 rtl8168_mdio_write(tp, 0x19, 0xb206);
15523 rtl8168_mdio_write(tp, 0x15, 0x0332);
15524 rtl8168_mdio_write(tp, 0x19, 0xb103);
15525 rtl8168_mdio_write(tp, 0x15, 0x0333);
15526 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15527 rtl8168_mdio_write(tp, 0x15, 0x0334);
15528 rtl8168_mdio_write(tp, 0x19, 0x3395);
15529 rtl8168_mdio_write(tp, 0x15, 0x0335);
15530 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15531 rtl8168_mdio_write(tp, 0x15, 0x0336);
15532 rtl8168_mdio_write(tp, 0x19, 0x33c6);
15533 rtl8168_mdio_write(tp, 0x15, 0x0337);
15534 rtl8168_mdio_write(tp, 0x19, 0xb103);
15535 rtl8168_mdio_write(tp, 0x15, 0x0338);
15536 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15537 rtl8168_mdio_write(tp, 0x15, 0x0339);
15538 rtl8168_mdio_write(tp, 0x19, 0x33d7);
15539 rtl8168_mdio_write(tp, 0x15, 0x033a);
15540 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15541 rtl8168_mdio_write(tp, 0x15, 0x033b);
15542 rtl8168_mdio_write(tp, 0x19, 0x33f2);
15543 rtl8168_mdio_write(tp, 0x15, 0x033c);
15544 rtl8168_mdio_write(tp, 0x19, 0x0000);
15545 rtl8168_mdio_write(tp, 0x15, 0x033d);
15546 rtl8168_mdio_write(tp, 0x19, 0x0000);
15547 rtl8168_mdio_write(tp, 0x15, 0x033e);
15548 rtl8168_mdio_write(tp, 0x19, 0x0000);
15549 rtl8168_mdio_write(tp, 0x15, 0x033f);
15550 rtl8168_mdio_write(tp, 0x19, 0x0000);
15551 rtl8168_mdio_write(tp, 0x15, 0x0340);
15552 rtl8168_mdio_write(tp, 0x19, 0x0000);
15553 rtl8168_mdio_write(tp, 0x15, 0x0341);
15554 rtl8168_mdio_write(tp, 0x19, 0x0000);
15555 rtl8168_mdio_write(tp, 0x15, 0x0342);
15556 rtl8168_mdio_write(tp, 0x19, 0x49b5);
15557 rtl8168_mdio_write(tp, 0x15, 0x0343);
15558 rtl8168_mdio_write(tp, 0x19, 0x7d00);
15559 rtl8168_mdio_write(tp, 0x15, 0x0344);
15560 rtl8168_mdio_write(tp, 0x19, 0x4d00);
15561 rtl8168_mdio_write(tp, 0x15, 0x0345);
15562 rtl8168_mdio_write(tp, 0x19, 0x6880);
15563 rtl8168_mdio_write(tp, 0x15, 0x0346);
15564 rtl8168_mdio_write(tp, 0x19, 0x7c08);
15565 rtl8168_mdio_write(tp, 0x15, 0x0347);
15566 rtl8168_mdio_write(tp, 0x19, 0x6c08);
15567 rtl8168_mdio_write(tp, 0x15, 0x0348);
15568 rtl8168_mdio_write(tp, 0x19, 0x4925);
15569 rtl8168_mdio_write(tp, 0x15, 0x0349);
15570 rtl8168_mdio_write(tp, 0x19, 0x403b);
15571 rtl8168_mdio_write(tp, 0x15, 0x034a);
15572 rtl8168_mdio_write(tp, 0x19, 0xa602);
15573 rtl8168_mdio_write(tp, 0x15, 0x034b);
15574 rtl8168_mdio_write(tp, 0x19, 0x402f);
15575 rtl8168_mdio_write(tp, 0x15, 0x034c);
15576 rtl8168_mdio_write(tp, 0x19, 0x4484);
15577 rtl8168_mdio_write(tp, 0x15, 0x034d);
15578 rtl8168_mdio_write(tp, 0x19, 0x40c8);
15579 rtl8168_mdio_write(tp, 0x15, 0x034e);
15580 rtl8168_mdio_write(tp, 0x19, 0x44c4);
15581 rtl8168_mdio_write(tp, 0x15, 0x034f);
15582 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15583 rtl8168_mdio_write(tp, 0x15, 0x0350);
15584 rtl8168_mdio_write(tp, 0x19, 0x00bd);
15585 rtl8168_mdio_write(tp, 0x15, 0x0351);
15586 rtl8168_mdio_write(tp, 0x19, 0x3311);
15587 rtl8168_mdio_write(tp, 0x15, 0x0352);
15588 rtl8168_mdio_write(tp, 0x19, 0xc8ed);
15589 rtl8168_mdio_write(tp, 0x15, 0x0353);
15590 rtl8168_mdio_write(tp, 0x19, 0x00fc);
15591 rtl8168_mdio_write(tp, 0x15, 0x0354);
15592 rtl8168_mdio_write(tp, 0x19, 0x8221);
15593 rtl8168_mdio_write(tp, 0x15, 0x0355);
15594 rtl8168_mdio_write(tp, 0x19, 0xd11d);
15595 rtl8168_mdio_write(tp, 0x15, 0x0356);
15596 rtl8168_mdio_write(tp, 0x19, 0x001f);
15597 rtl8168_mdio_write(tp, 0x15, 0x0357);
15598 rtl8168_mdio_write(tp, 0x19, 0xde18);
15599 rtl8168_mdio_write(tp, 0x15, 0x0358);
15600 rtl8168_mdio_write(tp, 0x19, 0x0008);
15601 rtl8168_mdio_write(tp, 0x15, 0x0359);
15602 rtl8168_mdio_write(tp, 0x19, 0x91f6);
15603 rtl8168_mdio_write(tp, 0x15, 0x035a);
15604 rtl8168_mdio_write(tp, 0x19, 0x3360);
15605 rtl8168_mdio_write(tp, 0x15, 0x035b);
15606 rtl8168_mdio_write(tp, 0x19, 0x0000);
15607 rtl8168_mdio_write(tp, 0x15, 0x035c);
15608 rtl8168_mdio_write(tp, 0x19, 0x0000);
15609 rtl8168_mdio_write(tp, 0x15, 0x035d);
15610 rtl8168_mdio_write(tp, 0x19, 0x0000);
15611 rtl8168_mdio_write(tp, 0x15, 0x035e);
15612 rtl8168_mdio_write(tp, 0x19, 0x0000);
15613 rtl8168_mdio_write(tp, 0x15, 0x035f);
15614 rtl8168_mdio_write(tp, 0x19, 0x0000);
15615 rtl8168_mdio_write(tp, 0x15, 0x0360);
15616 rtl8168_mdio_write(tp, 0x19, 0x4bb6);
15617 rtl8168_mdio_write(tp, 0x15, 0x0361);
15618 rtl8168_mdio_write(tp, 0x19, 0x4064);
15619 rtl8168_mdio_write(tp, 0x15, 0x0362);
15620 rtl8168_mdio_write(tp, 0x19, 0x4b26);
15621 rtl8168_mdio_write(tp, 0x15, 0x0363);
15622 rtl8168_mdio_write(tp, 0x19, 0x4410);
15623 rtl8168_mdio_write(tp, 0x15, 0x0364);
15624 rtl8168_mdio_write(tp, 0x19, 0x4006);
15625 rtl8168_mdio_write(tp, 0x15, 0x0365);
15626 rtl8168_mdio_write(tp, 0x19, 0x4490);
15627 rtl8168_mdio_write(tp, 0x15, 0x0366);
15628 rtl8168_mdio_write(tp, 0x19, 0x6900);
15629 rtl8168_mdio_write(tp, 0x15, 0x0367);
15630 rtl8168_mdio_write(tp, 0x19, 0xb6a6);
15631 rtl8168_mdio_write(tp, 0x15, 0x0368);
15632 rtl8168_mdio_write(tp, 0x19, 0x9e02);
15633 rtl8168_mdio_write(tp, 0x15, 0x0369);
15634 rtl8168_mdio_write(tp, 0x19, 0x3311);
15635 rtl8168_mdio_write(tp, 0x15, 0x036a);
15636 rtl8168_mdio_write(tp, 0x19, 0xd11d);
15637 rtl8168_mdio_write(tp, 0x15, 0x036b);
15638 rtl8168_mdio_write(tp, 0x19, 0x000a);
15639 rtl8168_mdio_write(tp, 0x15, 0x036c);
15640 rtl8168_mdio_write(tp, 0x19, 0xbb0f);
15641 rtl8168_mdio_write(tp, 0x15, 0x036d);
15642 rtl8168_mdio_write(tp, 0x19, 0x8102);
15643 rtl8168_mdio_write(tp, 0x15, 0x036e);
15644 rtl8168_mdio_write(tp, 0x19, 0x3371);
15645 rtl8168_mdio_write(tp, 0x15, 0x036f);
15646 rtl8168_mdio_write(tp, 0x19, 0xa21e);
15647 rtl8168_mdio_write(tp, 0x15, 0x0370);
15648 rtl8168_mdio_write(tp, 0x19, 0x33b6);
15649 rtl8168_mdio_write(tp, 0x15, 0x0371);
15650 rtl8168_mdio_write(tp, 0x19, 0x91f6);
15651 rtl8168_mdio_write(tp, 0x15, 0x0372);
15652 rtl8168_mdio_write(tp, 0x19, 0xc218);
15653 rtl8168_mdio_write(tp, 0x15, 0x0373);
15654 rtl8168_mdio_write(tp, 0x19, 0x00f4);
15655 rtl8168_mdio_write(tp, 0x15, 0x0374);
15656 rtl8168_mdio_write(tp, 0x19, 0x33b6);
15657 rtl8168_mdio_write(tp, 0x15, 0x0375);
15658 rtl8168_mdio_write(tp, 0x19, 0x32ec);
15659 rtl8168_mdio_write(tp, 0x15, 0x0376);
15660 rtl8168_mdio_write(tp, 0x19, 0x0000);
15661 rtl8168_mdio_write(tp, 0x15, 0x0377);
15662 rtl8168_mdio_write(tp, 0x19, 0x0000);
15663 rtl8168_mdio_write(tp, 0x15, 0x0378);
15664 rtl8168_mdio_write(tp, 0x19, 0x0000);
15665 rtl8168_mdio_write(tp, 0x15, 0x0379);
15666 rtl8168_mdio_write(tp, 0x19, 0x0000);
15667 rtl8168_mdio_write(tp, 0x15, 0x037a);
15668 rtl8168_mdio_write(tp, 0x19, 0x0000);
15669 rtl8168_mdio_write(tp, 0x15, 0x037b);
15670 rtl8168_mdio_write(tp, 0x19, 0x4b97);
15671 rtl8168_mdio_write(tp, 0x15, 0x037c);
15672 rtl8168_mdio_write(tp, 0x19, 0x402b);
15673 rtl8168_mdio_write(tp, 0x15, 0x037d);
15674 rtl8168_mdio_write(tp, 0x19, 0x4b07);
15675 rtl8168_mdio_write(tp, 0x15, 0x037e);
15676 rtl8168_mdio_write(tp, 0x19, 0x4422);
15677 rtl8168_mdio_write(tp, 0x15, 0x037f);
15678 rtl8168_mdio_write(tp, 0x19, 0x6980);
15679 rtl8168_mdio_write(tp, 0x15, 0x0380);
15680 rtl8168_mdio_write(tp, 0x19, 0xb608);
15681 rtl8168_mdio_write(tp, 0x15, 0x0381);
15682 rtl8168_mdio_write(tp, 0x19, 0x3311);
15683 rtl8168_mdio_write(tp, 0x15, 0x0382);
15684 rtl8168_mdio_write(tp, 0x19, 0xbc05);
15685 rtl8168_mdio_write(tp, 0x15, 0x0383);
15686 rtl8168_mdio_write(tp, 0x19, 0xc21c);
15687 rtl8168_mdio_write(tp, 0x15, 0x0384);
15688 rtl8168_mdio_write(tp, 0x19, 0x0032);
15689 rtl8168_mdio_write(tp, 0x15, 0x0385);
15690 rtl8168_mdio_write(tp, 0x19, 0xa1fb);
15691 rtl8168_mdio_write(tp, 0x15, 0x0386);
15692 rtl8168_mdio_write(tp, 0x19, 0x338d);
15693 rtl8168_mdio_write(tp, 0x15, 0x0387);
15694 rtl8168_mdio_write(tp, 0x19, 0x32ae);
15695 rtl8168_mdio_write(tp, 0x15, 0x0388);
15696 rtl8168_mdio_write(tp, 0x19, 0x330d);
15697 rtl8168_mdio_write(tp, 0x15, 0x0389);
15698 rtl8168_mdio_write(tp, 0x19, 0x0000);
15699 rtl8168_mdio_write(tp, 0x15, 0x038a);
15700 rtl8168_mdio_write(tp, 0x19, 0x0000);
15701 rtl8168_mdio_write(tp, 0x15, 0x038b);
15702 rtl8168_mdio_write(tp, 0x19, 0x0000);
15703 rtl8168_mdio_write(tp, 0x15, 0x038c);
15704 rtl8168_mdio_write(tp, 0x19, 0x0000);
15705 rtl8168_mdio_write(tp, 0x15, 0x038d);
15706 rtl8168_mdio_write(tp, 0x19, 0x4b97);
15707 rtl8168_mdio_write(tp, 0x15, 0x038e);
15708 rtl8168_mdio_write(tp, 0x19, 0x6a08);
15709 rtl8168_mdio_write(tp, 0x15, 0x038f);
15710 rtl8168_mdio_write(tp, 0x19, 0x4b07);
15711 rtl8168_mdio_write(tp, 0x15, 0x0390);
15712 rtl8168_mdio_write(tp, 0x19, 0x40ac);
15713 rtl8168_mdio_write(tp, 0x15, 0x0391);
15714 rtl8168_mdio_write(tp, 0x19, 0x4445);
15715 rtl8168_mdio_write(tp, 0x15, 0x0392);
15716 rtl8168_mdio_write(tp, 0x19, 0x404e);
15717 rtl8168_mdio_write(tp, 0x15, 0x0393);
15718 rtl8168_mdio_write(tp, 0x19, 0x4461);
15719 rtl8168_mdio_write(tp, 0x15, 0x0394);
15720 rtl8168_mdio_write(tp, 0x19, 0x3311);
15721 rtl8168_mdio_write(tp, 0x15, 0x0395);
15722 rtl8168_mdio_write(tp, 0x19, 0x9c0a);
15723 rtl8168_mdio_write(tp, 0x15, 0x0396);
15724 rtl8168_mdio_write(tp, 0x19, 0x63da);
15725 rtl8168_mdio_write(tp, 0x15, 0x0397);
15726 rtl8168_mdio_write(tp, 0x19, 0x6f0c);
15727 rtl8168_mdio_write(tp, 0x15, 0x0398);
15728 rtl8168_mdio_write(tp, 0x19, 0x5440);
15729 rtl8168_mdio_write(tp, 0x15, 0x0399);
15730 rtl8168_mdio_write(tp, 0x19, 0x4b98);
15731 rtl8168_mdio_write(tp, 0x15, 0x039a);
15732 rtl8168_mdio_write(tp, 0x19, 0x7c40);
15733 rtl8168_mdio_write(tp, 0x15, 0x039b);
15734 rtl8168_mdio_write(tp, 0x19, 0x4c00);
15735 rtl8168_mdio_write(tp, 0x15, 0x039c);
15736 rtl8168_mdio_write(tp, 0x19, 0x4b08);
15737 rtl8168_mdio_write(tp, 0x15, 0x039d);
15738 rtl8168_mdio_write(tp, 0x19, 0x63d8);
15739 rtl8168_mdio_write(tp, 0x15, 0x039e);
15740 rtl8168_mdio_write(tp, 0x19, 0x33a5);
15741 rtl8168_mdio_write(tp, 0x15, 0x039f);
15742 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15743 rtl8168_mdio_write(tp, 0x15, 0x03a0);
15744 rtl8168_mdio_write(tp, 0x19, 0x00e8);
15745 rtl8168_mdio_write(tp, 0x15, 0x03a1);
15746 rtl8168_mdio_write(tp, 0x19, 0x820e);
15747 rtl8168_mdio_write(tp, 0x15, 0x03a2);
15748 rtl8168_mdio_write(tp, 0x19, 0xa10d);
15749 rtl8168_mdio_write(tp, 0x15, 0x03a3);
15750 rtl8168_mdio_write(tp, 0x19, 0x9df1);
15751 rtl8168_mdio_write(tp, 0x15, 0x03a4);
15752 rtl8168_mdio_write(tp, 0x19, 0x33af);
15753 rtl8168_mdio_write(tp, 0x15, 0x03a5);
15754 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15755 rtl8168_mdio_write(tp, 0x15, 0x03a6);
15756 rtl8168_mdio_write(tp, 0x19, 0x00f9);
15757 rtl8168_mdio_write(tp, 0x15, 0x03a7);
15758 rtl8168_mdio_write(tp, 0x19, 0xc017);
15759 rtl8168_mdio_write(tp, 0x15, 0x03a8);
15760 rtl8168_mdio_write(tp, 0x19, 0x0007);
15761 rtl8168_mdio_write(tp, 0x15, 0x03a9);
15762 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15763 rtl8168_mdio_write(tp, 0x15, 0x03aa);
15764 rtl8168_mdio_write(tp, 0x19, 0x6c03);
15765 rtl8168_mdio_write(tp, 0x15, 0x03ab);
15766 rtl8168_mdio_write(tp, 0x19, 0xa104);
15767 rtl8168_mdio_write(tp, 0x15, 0x03ac);
15768 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15769 rtl8168_mdio_write(tp, 0x15, 0x03ad);
15770 rtl8168_mdio_write(tp, 0x19, 0x6c00);
15771 rtl8168_mdio_write(tp, 0x15, 0x03ae);
15772 rtl8168_mdio_write(tp, 0x19, 0x9df7);
15773 rtl8168_mdio_write(tp, 0x15, 0x03af);
15774 rtl8168_mdio_write(tp, 0x19, 0x7c03);
15775 rtl8168_mdio_write(tp, 0x15, 0x03b0);
15776 rtl8168_mdio_write(tp, 0x19, 0x6c08);
15777 rtl8168_mdio_write(tp, 0x15, 0x03b1);
15778 rtl8168_mdio_write(tp, 0x19, 0x33b6);
15779 rtl8168_mdio_write(tp, 0x15, 0x03b2);
15780 rtl8168_mdio_write(tp, 0x19, 0x0000);
15781 rtl8168_mdio_write(tp, 0x15, 0x03b3);
15782 rtl8168_mdio_write(tp, 0x19, 0x0000);
15783 rtl8168_mdio_write(tp, 0x15, 0x03b4);
15784 rtl8168_mdio_write(tp, 0x19, 0x0000);
15785 rtl8168_mdio_write(tp, 0x15, 0x03b5);
15786 rtl8168_mdio_write(tp, 0x19, 0x0000);
15787 rtl8168_mdio_write(tp, 0x15, 0x03b6);
15788 rtl8168_mdio_write(tp, 0x19, 0x55af);
15789 rtl8168_mdio_write(tp, 0x15, 0x03b7);
15790 rtl8168_mdio_write(tp, 0x19, 0x7ff0);
15791 rtl8168_mdio_write(tp, 0x15, 0x03b8);
15792 rtl8168_mdio_write(tp, 0x19, 0x6ff0);
15793 rtl8168_mdio_write(tp, 0x15, 0x03b9);
15794 rtl8168_mdio_write(tp, 0x19, 0x4bb9);
15795 rtl8168_mdio_write(tp, 0x15, 0x03ba);
15796 rtl8168_mdio_write(tp, 0x19, 0x6a80);
15797 rtl8168_mdio_write(tp, 0x15, 0x03bb);
15798 rtl8168_mdio_write(tp, 0x19, 0x4b29);
15799 rtl8168_mdio_write(tp, 0x15, 0x03bc);
15800 rtl8168_mdio_write(tp, 0x19, 0x4041);
15801 rtl8168_mdio_write(tp, 0x15, 0x03bd);
15802 rtl8168_mdio_write(tp, 0x19, 0x440a);
15803 rtl8168_mdio_write(tp, 0x15, 0x03be);
15804 rtl8168_mdio_write(tp, 0x19, 0x4029);
15805 rtl8168_mdio_write(tp, 0x15, 0x03bf);
15806 rtl8168_mdio_write(tp, 0x19, 0x4418);
15807 rtl8168_mdio_write(tp, 0x15, 0x03c0);
15808 rtl8168_mdio_write(tp, 0x19, 0x4090);
15809 rtl8168_mdio_write(tp, 0x15, 0x03c1);
15810 rtl8168_mdio_write(tp, 0x19, 0x4438);
15811 rtl8168_mdio_write(tp, 0x15, 0x03c2);
15812 rtl8168_mdio_write(tp, 0x19, 0x40c4);
15813 rtl8168_mdio_write(tp, 0x15, 0x03c3);
15814 rtl8168_mdio_write(tp, 0x19, 0x447b);
15815 rtl8168_mdio_write(tp, 0x15, 0x03c4);
15816 rtl8168_mdio_write(tp, 0x19, 0xb6c4);
15817 rtl8168_mdio_write(tp, 0x15, 0x03c5);
15818 rtl8168_mdio_write(tp, 0x19, 0x3311);
15819 rtl8168_mdio_write(tp, 0x15, 0x03c6);
15820 rtl8168_mdio_write(tp, 0x19, 0x9bfe);
15821 rtl8168_mdio_write(tp, 0x15, 0x03c7);
15822 rtl8168_mdio_write(tp, 0x19, 0x33cc);
15823 rtl8168_mdio_write(tp, 0x15, 0x03c8);
15824 rtl8168_mdio_write(tp, 0x19, 0x0000);
15825 rtl8168_mdio_write(tp, 0x15, 0x03c9);
15826 rtl8168_mdio_write(tp, 0x19, 0x0000);
15827 rtl8168_mdio_write(tp, 0x15, 0x03ca);
15828 rtl8168_mdio_write(tp, 0x19, 0x0000);
15829 rtl8168_mdio_write(tp, 0x15, 0x03cb);
15830 rtl8168_mdio_write(tp, 0x19, 0x0000);
15831 rtl8168_mdio_write(tp, 0x15, 0x03cc);
15832 rtl8168_mdio_write(tp, 0x19, 0x542f);
15833 rtl8168_mdio_write(tp, 0x15, 0x03cd);
15834 rtl8168_mdio_write(tp, 0x19, 0x499a);
15835 rtl8168_mdio_write(tp, 0x15, 0x03ce);
15836 rtl8168_mdio_write(tp, 0x19, 0x7c40);
15837 rtl8168_mdio_write(tp, 0x15, 0x03cf);
15838 rtl8168_mdio_write(tp, 0x19, 0x4c40);
15839 rtl8168_mdio_write(tp, 0x15, 0x03d0);
15840 rtl8168_mdio_write(tp, 0x19, 0x490a);
15841 rtl8168_mdio_write(tp, 0x15, 0x03d1);
15842 rtl8168_mdio_write(tp, 0x19, 0x405e);
15843 rtl8168_mdio_write(tp, 0x15, 0x03d2);
15844 rtl8168_mdio_write(tp, 0x19, 0x44f8);
15845 rtl8168_mdio_write(tp, 0x15, 0x03d3);
15846 rtl8168_mdio_write(tp, 0x19, 0x6b00);
15847 rtl8168_mdio_write(tp, 0x15, 0x03d4);
15848 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15849 rtl8168_mdio_write(tp, 0x15, 0x03d5);
15850 rtl8168_mdio_write(tp, 0x19, 0x0028);
15851 rtl8168_mdio_write(tp, 0x15, 0x03d6);
15852 rtl8168_mdio_write(tp, 0x19, 0x3311);
15853 rtl8168_mdio_write(tp, 0x15, 0x03d7);
15854 rtl8168_mdio_write(tp, 0x19, 0xbd27);
15855 rtl8168_mdio_write(tp, 0x15, 0x03d8);
15856 rtl8168_mdio_write(tp, 0x19, 0x9cfc);
15857 rtl8168_mdio_write(tp, 0x15, 0x03d9);
15858 rtl8168_mdio_write(tp, 0x19, 0xc639);
15859 rtl8168_mdio_write(tp, 0x15, 0x03da);
15860 rtl8168_mdio_write(tp, 0x19, 0x000f);
15861 rtl8168_mdio_write(tp, 0x15, 0x03db);
15862 rtl8168_mdio_write(tp, 0x19, 0x9e03);
15863 rtl8168_mdio_write(tp, 0x15, 0x03dc);
15864 rtl8168_mdio_write(tp, 0x19, 0x7c01);
15865 rtl8168_mdio_write(tp, 0x15, 0x03dd);
15866 rtl8168_mdio_write(tp, 0x19, 0x4c01);
15867 rtl8168_mdio_write(tp, 0x15, 0x03de);
15868 rtl8168_mdio_write(tp, 0x19, 0x9af6);
15869 rtl8168_mdio_write(tp, 0x15, 0x03df);
15870 rtl8168_mdio_write(tp, 0x19, 0x7c12);
15871 rtl8168_mdio_write(tp, 0x15, 0x03e0);
15872 rtl8168_mdio_write(tp, 0x19, 0x4c52);
15873 rtl8168_mdio_write(tp, 0x15, 0x03e1);
15874 rtl8168_mdio_write(tp, 0x19, 0x4470);
15875 rtl8168_mdio_write(tp, 0x15, 0x03e2);
15876 rtl8168_mdio_write(tp, 0x19, 0x7c12);
15877 rtl8168_mdio_write(tp, 0x15, 0x03e3);
15878 rtl8168_mdio_write(tp, 0x19, 0x4c40);
15879 rtl8168_mdio_write(tp, 0x15, 0x03e4);
15880 rtl8168_mdio_write(tp, 0x19, 0x33d4);
15881 rtl8168_mdio_write(tp, 0x15, 0x03e5);
15882 rtl8168_mdio_write(tp, 0x19, 0x0000);
15883 rtl8168_mdio_write(tp, 0x15, 0x03e6);
15884 rtl8168_mdio_write(tp, 0x19, 0x0000);
15885 rtl8168_mdio_write(tp, 0x15, 0x03e7);
15886 rtl8168_mdio_write(tp, 0x19, 0x0000);
15887 rtl8168_mdio_write(tp, 0x15, 0x03e8);
15888 rtl8168_mdio_write(tp, 0x19, 0x0000);
15889 rtl8168_mdio_write(tp, 0x15, 0x03e9);
15890 rtl8168_mdio_write(tp, 0x19, 0x49bb);
15891 rtl8168_mdio_write(tp, 0x15, 0x03ea);
15892 rtl8168_mdio_write(tp, 0x19, 0x4478);
15893 rtl8168_mdio_write(tp, 0x15, 0x03eb);
15894 rtl8168_mdio_write(tp, 0x19, 0x492b);
15895 rtl8168_mdio_write(tp, 0x15, 0x03ec);
15896 rtl8168_mdio_write(tp, 0x19, 0x6b80);
15897 rtl8168_mdio_write(tp, 0x15, 0x03ed);
15898 rtl8168_mdio_write(tp, 0x19, 0x7c01);
15899 rtl8168_mdio_write(tp, 0x15, 0x03ee);
15900 rtl8168_mdio_write(tp, 0x19, 0x4c00);
15901 rtl8168_mdio_write(tp, 0x15, 0x03ef);
15902 rtl8168_mdio_write(tp, 0x19, 0xd64f);
15903 rtl8168_mdio_write(tp, 0x15, 0x03f0);
15904 rtl8168_mdio_write(tp, 0x19, 0x000d);
15905 rtl8168_mdio_write(tp, 0x15, 0x03f1);
15906 rtl8168_mdio_write(tp, 0x19, 0x3311);
15907 rtl8168_mdio_write(tp, 0x15, 0x03f2);
15908 rtl8168_mdio_write(tp, 0x19, 0xbd0c);
15909 rtl8168_mdio_write(tp, 0x15, 0x03f3);
15910 rtl8168_mdio_write(tp, 0x19, 0xc428);
15911 rtl8168_mdio_write(tp, 0x15, 0x03f4);
15912 rtl8168_mdio_write(tp, 0x19, 0x0008);
15913 rtl8168_mdio_write(tp, 0x15, 0x03f5);
15914 rtl8168_mdio_write(tp, 0x19, 0x9afa);
15915 rtl8168_mdio_write(tp, 0x15, 0x03f6);
15916 rtl8168_mdio_write(tp, 0x19, 0x7c12);
15917 rtl8168_mdio_write(tp, 0x15, 0x03f7);
15918 rtl8168_mdio_write(tp, 0x19, 0x4c52);
15919 rtl8168_mdio_write(tp, 0x15, 0x03f8);
15920 rtl8168_mdio_write(tp, 0x19, 0x4470);
15921 rtl8168_mdio_write(tp, 0x15, 0x03f9);
15922 rtl8168_mdio_write(tp, 0x19, 0x7c12);
15923 rtl8168_mdio_write(tp, 0x15, 0x03fa);
15924 rtl8168_mdio_write(tp, 0x19, 0x4c40);
15925 rtl8168_mdio_write(tp, 0x15, 0x03fb);
15926 rtl8168_mdio_write(tp, 0x19, 0x33ef);
15927 rtl8168_mdio_write(tp, 0x15, 0x03fc);
15928 rtl8168_mdio_write(tp, 0x19, 0x3342);
15929 rtl8168_mdio_write(tp, 0x15, 0x03fd);
15930 rtl8168_mdio_write(tp, 0x19, 0x330d);
15931 rtl8168_mdio_write(tp, 0x15, 0x03fe);
15932 rtl8168_mdio_write(tp, 0x19, 0x32ae);
15933 rtl8168_mdio_write(tp, 0x15, 0x0000);
15934 rtl8168_mdio_write(tp, 0x16, 0x0306);
15935 rtl8168_mdio_write(tp, 0x16, 0x0300);
15936 rtl8168_mdio_write(tp, 0x1f, 0x0002);
15937 rtl8168_mdio_write(tp, 0x1f, 0x0000);
15938 rtl8168_mdio_write(tp, 0x1f, 0x0005);
15939 rtl8168_mdio_write(tp, 0x05, 0xfff6);
15940 rtl8168_mdio_write(tp, 0x06, 0x0080);
15941 rtl8168_mdio_write(tp, 0x05, 0x8000);
15942 rtl8168_mdio_write(tp, 0x06, 0x0280);
15943 rtl8168_mdio_write(tp, 0x06, 0x48f7);
15944 rtl8168_mdio_write(tp, 0x06, 0x00e0);
15945 rtl8168_mdio_write(tp, 0x06, 0xfff7);
15946 rtl8168_mdio_write(tp, 0x06, 0xa080);
15947 rtl8168_mdio_write(tp, 0x06, 0x02ae);
15948 rtl8168_mdio_write(tp, 0x06, 0xf602);
15949 rtl8168_mdio_write(tp, 0x06, 0x0112);
15950 rtl8168_mdio_write(tp, 0x06, 0x0201);
15951 rtl8168_mdio_write(tp, 0x06, 0x1f02);
15952 rtl8168_mdio_write(tp, 0x06, 0x012c);
15953 rtl8168_mdio_write(tp, 0x06, 0x0201);
15954 rtl8168_mdio_write(tp, 0x06, 0x3c02);
15955 rtl8168_mdio_write(tp, 0x06, 0x0156);
15956 rtl8168_mdio_write(tp, 0x06, 0x0201);
15957 rtl8168_mdio_write(tp, 0x06, 0x6d02);
15958 rtl8168_mdio_write(tp, 0x06, 0x809d);
15959 rtl8168_mdio_write(tp, 0x06, 0xe08b);
15960 rtl8168_mdio_write(tp, 0x06, 0x88e1);
15961 rtl8168_mdio_write(tp, 0x06, 0x8b89);
15962 rtl8168_mdio_write(tp, 0x06, 0x1e01);
15963 rtl8168_mdio_write(tp, 0x06, 0xe18b);
15964 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
15965 rtl8168_mdio_write(tp, 0x06, 0x01e1);
15966 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
15967 rtl8168_mdio_write(tp, 0x06, 0x1e01);
15968 rtl8168_mdio_write(tp, 0x06, 0xe18b);
15969 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
15970 rtl8168_mdio_write(tp, 0x06, 0x01e1);
15971 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
15972 rtl8168_mdio_write(tp, 0x06, 0x1e01);
15973 rtl8168_mdio_write(tp, 0x06, 0xe18b);
15974 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
15975 rtl8168_mdio_write(tp, 0x06, 0x01a0);
15976 rtl8168_mdio_write(tp, 0x06, 0x00c7);
15977 rtl8168_mdio_write(tp, 0x06, 0xaebb);
15978 rtl8168_mdio_write(tp, 0x06, 0xd100);
15979 rtl8168_mdio_write(tp, 0x06, 0xbf82);
15980 rtl8168_mdio_write(tp, 0x06, 0xc702);
15981 rtl8168_mdio_write(tp, 0x06, 0x320a);
15982 rtl8168_mdio_write(tp, 0x06, 0xd105);
15983 rtl8168_mdio_write(tp, 0x06, 0xbf82);
15984 rtl8168_mdio_write(tp, 0x06, 0xcd02);
15985 rtl8168_mdio_write(tp, 0x06, 0x320a);
15986 rtl8168_mdio_write(tp, 0x06, 0xd100);
15987 rtl8168_mdio_write(tp, 0x06, 0xbf82);
15988 rtl8168_mdio_write(tp, 0x06, 0xca02);
15989 rtl8168_mdio_write(tp, 0x06, 0x320a);
15990 rtl8168_mdio_write(tp, 0x06, 0xd105);
15991 rtl8168_mdio_write(tp, 0x06, 0xbf82);
15992 rtl8168_mdio_write(tp, 0x06, 0xd002);
15993 rtl8168_mdio_write(tp, 0x06, 0x320a);
15994 rtl8168_mdio_write(tp, 0x06, 0xd481);
15995 rtl8168_mdio_write(tp, 0x06, 0xc9e4);
15996 rtl8168_mdio_write(tp, 0x06, 0x8b90);
15997 rtl8168_mdio_write(tp, 0x06, 0xe58b);
15998 rtl8168_mdio_write(tp, 0x06, 0x91d4);
15999 rtl8168_mdio_write(tp, 0x06, 0x81b8);
16000 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16001 rtl8168_mdio_write(tp, 0x06, 0x92e5);
16002 rtl8168_mdio_write(tp, 0x06, 0x8b93);
16003 rtl8168_mdio_write(tp, 0x06, 0xbf8b);
16004 rtl8168_mdio_write(tp, 0x06, 0x88ec);
16005 rtl8168_mdio_write(tp, 0x06, 0x0019);
16006 rtl8168_mdio_write(tp, 0x06, 0xa98b);
16007 rtl8168_mdio_write(tp, 0x06, 0x90f9);
16008 rtl8168_mdio_write(tp, 0x06, 0xeeff);
16009 rtl8168_mdio_write(tp, 0x06, 0xf600);
16010 rtl8168_mdio_write(tp, 0x06, 0xeeff);
16011 rtl8168_mdio_write(tp, 0x06, 0xf7fc);
16012 rtl8168_mdio_write(tp, 0x06, 0xd100);
16013 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16014 rtl8168_mdio_write(tp, 0x06, 0xc102);
16015 rtl8168_mdio_write(tp, 0x06, 0x320a);
16016 rtl8168_mdio_write(tp, 0x06, 0xd101);
16017 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16018 rtl8168_mdio_write(tp, 0x06, 0xc402);
16019 rtl8168_mdio_write(tp, 0x06, 0x320a);
16020 rtl8168_mdio_write(tp, 0x06, 0x04f8);
16021 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16022 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16023 rtl8168_mdio_write(tp, 0x06, 0x201a);
16024 rtl8168_mdio_write(tp, 0x06, 0xf620);
16025 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16026 rtl8168_mdio_write(tp, 0x06, 0x8e02);
16027 rtl8168_mdio_write(tp, 0x06, 0x824b);
16028 rtl8168_mdio_write(tp, 0x06, 0x0281);
16029 rtl8168_mdio_write(tp, 0x06, 0x1902);
16030 rtl8168_mdio_write(tp, 0x06, 0x2c9d);
16031 rtl8168_mdio_write(tp, 0x06, 0x0203);
16032 rtl8168_mdio_write(tp, 0x06, 0x9602);
16033 rtl8168_mdio_write(tp, 0x06, 0x0473);
16034 rtl8168_mdio_write(tp, 0x06, 0x022e);
16035 rtl8168_mdio_write(tp, 0x06, 0x3902);
16036 rtl8168_mdio_write(tp, 0x06, 0x044d);
16037 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16038 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16039 rtl8168_mdio_write(tp, 0x06, 0x210b);
16040 rtl8168_mdio_write(tp, 0x06, 0xf621);
16041 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16042 rtl8168_mdio_write(tp, 0x06, 0x8e02);
16043 rtl8168_mdio_write(tp, 0x06, 0x0416);
16044 rtl8168_mdio_write(tp, 0x06, 0x021b);
16045 rtl8168_mdio_write(tp, 0x06, 0xa4e0);
16046 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16047 rtl8168_mdio_write(tp, 0x06, 0xad22);
16048 rtl8168_mdio_write(tp, 0x06, 0x05f6);
16049 rtl8168_mdio_write(tp, 0x06, 0x22e4);
16050 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16051 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16052 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16053 rtl8168_mdio_write(tp, 0x06, 0x2305);
16054 rtl8168_mdio_write(tp, 0x06, 0xf623);
16055 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16056 rtl8168_mdio_write(tp, 0x06, 0x8ee0);
16057 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16058 rtl8168_mdio_write(tp, 0x06, 0xad24);
16059 rtl8168_mdio_write(tp, 0x06, 0x05f6);
16060 rtl8168_mdio_write(tp, 0x06, 0x24e4);
16061 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16062 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16063 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16064 rtl8168_mdio_write(tp, 0x06, 0x2505);
16065 rtl8168_mdio_write(tp, 0x06, 0xf625);
16066 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16067 rtl8168_mdio_write(tp, 0x06, 0x8ee0);
16068 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16069 rtl8168_mdio_write(tp, 0x06, 0xad26);
16070 rtl8168_mdio_write(tp, 0x06, 0x08f6);
16071 rtl8168_mdio_write(tp, 0x06, 0x26e4);
16072 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16073 rtl8168_mdio_write(tp, 0x06, 0x0281);
16074 rtl8168_mdio_write(tp, 0x06, 0xdae0);
16075 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16076 rtl8168_mdio_write(tp, 0x06, 0xad27);
16077 rtl8168_mdio_write(tp, 0x06, 0x05f6);
16078 rtl8168_mdio_write(tp, 0x06, 0x27e4);
16079 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16080 rtl8168_mdio_write(tp, 0x06, 0x0203);
16081 rtl8168_mdio_write(tp, 0x06, 0x5cfc);
16082 rtl8168_mdio_write(tp, 0x06, 0x04f8);
16083 rtl8168_mdio_write(tp, 0x06, 0xfaef);
16084 rtl8168_mdio_write(tp, 0x06, 0x69e0);
16085 rtl8168_mdio_write(tp, 0x06, 0x8b85);
16086 rtl8168_mdio_write(tp, 0x06, 0xad21);
16087 rtl8168_mdio_write(tp, 0x06, 0x57e0);
16088 rtl8168_mdio_write(tp, 0x06, 0xe022);
16089 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
16090 rtl8168_mdio_write(tp, 0x06, 0x2358);
16091 rtl8168_mdio_write(tp, 0x06, 0xc059);
16092 rtl8168_mdio_write(tp, 0x06, 0x021e);
16093 rtl8168_mdio_write(tp, 0x06, 0x01e1);
16094 rtl8168_mdio_write(tp, 0x06, 0x8b3c);
16095 rtl8168_mdio_write(tp, 0x06, 0x1f10);
16096 rtl8168_mdio_write(tp, 0x06, 0x9e44);
16097 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16098 rtl8168_mdio_write(tp, 0x06, 0x3cad);
16099 rtl8168_mdio_write(tp, 0x06, 0x211d);
16100 rtl8168_mdio_write(tp, 0x06, 0xe18b);
16101 rtl8168_mdio_write(tp, 0x06, 0x84f7);
16102 rtl8168_mdio_write(tp, 0x06, 0x29e5);
16103 rtl8168_mdio_write(tp, 0x06, 0x8b84);
16104 rtl8168_mdio_write(tp, 0x06, 0xac27);
16105 rtl8168_mdio_write(tp, 0x06, 0x0dac);
16106 rtl8168_mdio_write(tp, 0x06, 0x2605);
16107 rtl8168_mdio_write(tp, 0x06, 0x0281);
16108 rtl8168_mdio_write(tp, 0x06, 0x7fae);
16109 rtl8168_mdio_write(tp, 0x06, 0x2b02);
16110 rtl8168_mdio_write(tp, 0x06, 0x2c23);
16111 rtl8168_mdio_write(tp, 0x06, 0xae26);
16112 rtl8168_mdio_write(tp, 0x06, 0x022c);
16113 rtl8168_mdio_write(tp, 0x06, 0x41ae);
16114 rtl8168_mdio_write(tp, 0x06, 0x21e0);
16115 rtl8168_mdio_write(tp, 0x06, 0x8b87);
16116 rtl8168_mdio_write(tp, 0x06, 0xad22);
16117 rtl8168_mdio_write(tp, 0x06, 0x18e0);
16118 rtl8168_mdio_write(tp, 0x06, 0xfff7);
16119 rtl8168_mdio_write(tp, 0x06, 0x58fc);
16120 rtl8168_mdio_write(tp, 0x06, 0xe4ff);
16121 rtl8168_mdio_write(tp, 0x06, 0xf7d1);
16122 rtl8168_mdio_write(tp, 0x06, 0x00bf);
16123 rtl8168_mdio_write(tp, 0x06, 0x2eee);
16124 rtl8168_mdio_write(tp, 0x06, 0x0232);
16125 rtl8168_mdio_write(tp, 0x06, 0x0ad1);
16126 rtl8168_mdio_write(tp, 0x06, 0x00bf);
16127 rtl8168_mdio_write(tp, 0x06, 0x82e8);
16128 rtl8168_mdio_write(tp, 0x06, 0x0232);
16129 rtl8168_mdio_write(tp, 0x06, 0x0a02);
16130 rtl8168_mdio_write(tp, 0x06, 0x2bdf);
16131 rtl8168_mdio_write(tp, 0x06, 0xef96);
16132 rtl8168_mdio_write(tp, 0x06, 0xfefc);
16133 rtl8168_mdio_write(tp, 0x06, 0x04d0);
16134 rtl8168_mdio_write(tp, 0x06, 0x0202);
16135 rtl8168_mdio_write(tp, 0x06, 0x1e97);
16136 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16137 rtl8168_mdio_write(tp, 0x06, 0x87ad);
16138 rtl8168_mdio_write(tp, 0x06, 0x2228);
16139 rtl8168_mdio_write(tp, 0x06, 0xd100);
16140 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16141 rtl8168_mdio_write(tp, 0x06, 0xd302);
16142 rtl8168_mdio_write(tp, 0x06, 0x320a);
16143 rtl8168_mdio_write(tp, 0x06, 0xd10c);
16144 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16145 rtl8168_mdio_write(tp, 0x06, 0xd602);
16146 rtl8168_mdio_write(tp, 0x06, 0x320a);
16147 rtl8168_mdio_write(tp, 0x06, 0xd104);
16148 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16149 rtl8168_mdio_write(tp, 0x06, 0xd902);
16150 rtl8168_mdio_write(tp, 0x06, 0x320a);
16151 rtl8168_mdio_write(tp, 0x06, 0xd101);
16152 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16153 rtl8168_mdio_write(tp, 0x06, 0xe802);
16154 rtl8168_mdio_write(tp, 0x06, 0x320a);
16155 rtl8168_mdio_write(tp, 0x06, 0xe0ff);
16156 rtl8168_mdio_write(tp, 0x06, 0xf768);
16157 rtl8168_mdio_write(tp, 0x06, 0x03e4);
16158 rtl8168_mdio_write(tp, 0x06, 0xfff7);
16159 rtl8168_mdio_write(tp, 0x06, 0xd004);
16160 rtl8168_mdio_write(tp, 0x06, 0x0228);
16161 rtl8168_mdio_write(tp, 0x06, 0x7a04);
16162 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
16163 rtl8168_mdio_write(tp, 0x06, 0xe234);
16164 rtl8168_mdio_write(tp, 0x06, 0xe1e2);
16165 rtl8168_mdio_write(tp, 0x06, 0x35f6);
16166 rtl8168_mdio_write(tp, 0x06, 0x2be4);
16167 rtl8168_mdio_write(tp, 0x06, 0xe234);
16168 rtl8168_mdio_write(tp, 0x06, 0xe5e2);
16169 rtl8168_mdio_write(tp, 0x06, 0x35fc);
16170 rtl8168_mdio_write(tp, 0x06, 0x05f8);
16171 rtl8168_mdio_write(tp, 0x06, 0xe0e2);
16172 rtl8168_mdio_write(tp, 0x06, 0x34e1);
16173 rtl8168_mdio_write(tp, 0x06, 0xe235);
16174 rtl8168_mdio_write(tp, 0x06, 0xf72b);
16175 rtl8168_mdio_write(tp, 0x06, 0xe4e2);
16176 rtl8168_mdio_write(tp, 0x06, 0x34e5);
16177 rtl8168_mdio_write(tp, 0x06, 0xe235);
16178 rtl8168_mdio_write(tp, 0x06, 0xfc05);
16179 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
16180 rtl8168_mdio_write(tp, 0x06, 0xfaef);
16181 rtl8168_mdio_write(tp, 0x06, 0x69ac);
16182 rtl8168_mdio_write(tp, 0x06, 0x1b4c);
16183 rtl8168_mdio_write(tp, 0x06, 0xbf2e);
16184 rtl8168_mdio_write(tp, 0x06, 0x3002);
16185 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16186 rtl8168_mdio_write(tp, 0x06, 0xef01);
16187 rtl8168_mdio_write(tp, 0x06, 0xe28a);
16188 rtl8168_mdio_write(tp, 0x06, 0x76e4);
16189 rtl8168_mdio_write(tp, 0x06, 0x8a76);
16190 rtl8168_mdio_write(tp, 0x06, 0x1f12);
16191 rtl8168_mdio_write(tp, 0x06, 0x9e3a);
16192 rtl8168_mdio_write(tp, 0x06, 0xef12);
16193 rtl8168_mdio_write(tp, 0x06, 0x5907);
16194 rtl8168_mdio_write(tp, 0x06, 0x9f12);
16195 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
16196 rtl8168_mdio_write(tp, 0x06, 0x8b40);
16197 rtl8168_mdio_write(tp, 0x06, 0xf721);
16198 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16199 rtl8168_mdio_write(tp, 0x06, 0x40d0);
16200 rtl8168_mdio_write(tp, 0x06, 0x0302);
16201 rtl8168_mdio_write(tp, 0x06, 0x287a);
16202 rtl8168_mdio_write(tp, 0x06, 0x0282);
16203 rtl8168_mdio_write(tp, 0x06, 0x34fc);
16204 rtl8168_mdio_write(tp, 0x06, 0xa000);
16205 rtl8168_mdio_write(tp, 0x06, 0x1002);
16206 rtl8168_mdio_write(tp, 0x06, 0x2dc3);
16207 rtl8168_mdio_write(tp, 0x06, 0x022e);
16208 rtl8168_mdio_write(tp, 0x06, 0x21e0);
16209 rtl8168_mdio_write(tp, 0x06, 0x8b40);
16210 rtl8168_mdio_write(tp, 0x06, 0xf621);
16211 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16212 rtl8168_mdio_write(tp, 0x06, 0x40ae);
16213 rtl8168_mdio_write(tp, 0x06, 0x0fbf);
16214 rtl8168_mdio_write(tp, 0x06, 0x3fa5);
16215 rtl8168_mdio_write(tp, 0x06, 0x0231);
16216 rtl8168_mdio_write(tp, 0x06, 0x6cbf);
16217 rtl8168_mdio_write(tp, 0x06, 0x3fa2);
16218 rtl8168_mdio_write(tp, 0x06, 0x0231);
16219 rtl8168_mdio_write(tp, 0x06, 0x6c02);
16220 rtl8168_mdio_write(tp, 0x06, 0x2dc3);
16221 rtl8168_mdio_write(tp, 0x06, 0xef96);
16222 rtl8168_mdio_write(tp, 0x06, 0xfefd);
16223 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16224 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
16225 rtl8168_mdio_write(tp, 0x06, 0xe2f4);
16226 rtl8168_mdio_write(tp, 0x06, 0xe1e2);
16227 rtl8168_mdio_write(tp, 0x06, 0xf5e4);
16228 rtl8168_mdio_write(tp, 0x06, 0x8a78);
16229 rtl8168_mdio_write(tp, 0x06, 0xe58a);
16230 rtl8168_mdio_write(tp, 0x06, 0x79ee);
16231 rtl8168_mdio_write(tp, 0x06, 0xe2f4);
16232 rtl8168_mdio_write(tp, 0x06, 0xd8ee);
16233 rtl8168_mdio_write(tp, 0x06, 0xe2f5);
16234 rtl8168_mdio_write(tp, 0x06, 0x20fc);
16235 rtl8168_mdio_write(tp, 0x06, 0x04f8);
16236 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
16237 rtl8168_mdio_write(tp, 0x06, 0xef69);
16238 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16239 rtl8168_mdio_write(tp, 0x06, 0x87ad);
16240 rtl8168_mdio_write(tp, 0x06, 0x2065);
16241 rtl8168_mdio_write(tp, 0x06, 0xd200);
16242 rtl8168_mdio_write(tp, 0x06, 0xbf2e);
16243 rtl8168_mdio_write(tp, 0x06, 0xe802);
16244 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16245 rtl8168_mdio_write(tp, 0x06, 0x1e21);
16246 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16247 rtl8168_mdio_write(tp, 0x06, 0xdf02);
16248 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16249 rtl8168_mdio_write(tp, 0x06, 0x0c11);
16250 rtl8168_mdio_write(tp, 0x06, 0x1e21);
16251 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16252 rtl8168_mdio_write(tp, 0x06, 0xe202);
16253 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16254 rtl8168_mdio_write(tp, 0x06, 0x0c12);
16255 rtl8168_mdio_write(tp, 0x06, 0x1e21);
16256 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16257 rtl8168_mdio_write(tp, 0x06, 0xe502);
16258 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16259 rtl8168_mdio_write(tp, 0x06, 0x0c13);
16260 rtl8168_mdio_write(tp, 0x06, 0x1e21);
16261 rtl8168_mdio_write(tp, 0x06, 0xbf1f);
16262 rtl8168_mdio_write(tp, 0x06, 0x5302);
16263 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16264 rtl8168_mdio_write(tp, 0x06, 0x0c14);
16265 rtl8168_mdio_write(tp, 0x06, 0x1e21);
16266 rtl8168_mdio_write(tp, 0x06, 0xbf82);
16267 rtl8168_mdio_write(tp, 0x06, 0xeb02);
16268 rtl8168_mdio_write(tp, 0x06, 0x31dd);
16269 rtl8168_mdio_write(tp, 0x06, 0x0c16);
16270 rtl8168_mdio_write(tp, 0x06, 0x1e21);
16271 rtl8168_mdio_write(tp, 0x06, 0xe083);
16272 rtl8168_mdio_write(tp, 0x06, 0xe01f);
16273 rtl8168_mdio_write(tp, 0x06, 0x029e);
16274 rtl8168_mdio_write(tp, 0x06, 0x22e6);
16275 rtl8168_mdio_write(tp, 0x06, 0x83e0);
16276 rtl8168_mdio_write(tp, 0x06, 0xad31);
16277 rtl8168_mdio_write(tp, 0x06, 0x14ad);
16278 rtl8168_mdio_write(tp, 0x06, 0x3011);
16279 rtl8168_mdio_write(tp, 0x06, 0xef02);
16280 rtl8168_mdio_write(tp, 0x06, 0x580c);
16281 rtl8168_mdio_write(tp, 0x06, 0x9e07);
16282 rtl8168_mdio_write(tp, 0x06, 0xad36);
16283 rtl8168_mdio_write(tp, 0x06, 0x085a);
16284 rtl8168_mdio_write(tp, 0x06, 0x309f);
16285 rtl8168_mdio_write(tp, 0x06, 0x04d1);
16286 rtl8168_mdio_write(tp, 0x06, 0x01ae);
16287 rtl8168_mdio_write(tp, 0x06, 0x02d1);
16288 rtl8168_mdio_write(tp, 0x06, 0x00bf);
16289 rtl8168_mdio_write(tp, 0x06, 0x82dc);
16290 rtl8168_mdio_write(tp, 0x06, 0x0232);
16291 rtl8168_mdio_write(tp, 0x06, 0x0aef);
16292 rtl8168_mdio_write(tp, 0x06, 0x96fe);
16293 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
16294 rtl8168_mdio_write(tp, 0x06, 0x0400);
16295 rtl8168_mdio_write(tp, 0x06, 0xe140);
16296 rtl8168_mdio_write(tp, 0x06, 0x77e1);
16297 rtl8168_mdio_write(tp, 0x06, 0x4010);
16298 rtl8168_mdio_write(tp, 0x06, 0xe150);
16299 rtl8168_mdio_write(tp, 0x06, 0x32e1);
16300 rtl8168_mdio_write(tp, 0x06, 0x5030);
16301 rtl8168_mdio_write(tp, 0x06, 0xe144);
16302 rtl8168_mdio_write(tp, 0x06, 0x74e1);
16303 rtl8168_mdio_write(tp, 0x06, 0x44bb);
16304 rtl8168_mdio_write(tp, 0x06, 0xe2d2);
16305 rtl8168_mdio_write(tp, 0x06, 0x40e0);
16306 rtl8168_mdio_write(tp, 0x06, 0x2cfc);
16307 rtl8168_mdio_write(tp, 0x06, 0xe2cc);
16308 rtl8168_mdio_write(tp, 0x06, 0xcce2);
16309 rtl8168_mdio_write(tp, 0x06, 0x00cc);
16310 rtl8168_mdio_write(tp, 0x06, 0xe000);
16311 rtl8168_mdio_write(tp, 0x06, 0x99e0);
16312 rtl8168_mdio_write(tp, 0x06, 0x3688);
16313 rtl8168_mdio_write(tp, 0x06, 0xe036);
16314 rtl8168_mdio_write(tp, 0x06, 0x99e1);
16315 rtl8168_mdio_write(tp, 0x06, 0x40dd);
16316 rtl8168_mdio_write(tp, 0x06, 0xe022);
16317 rtl8168_mdio_write(tp, 0x05, 0xe142);
16318 gphy_val = rtl8168_mdio_read(tp, 0x06);
16319 gphy_val |= BIT_0;
16320 rtl8168_mdio_write(tp, 0x06, gphy_val);
16321 rtl8168_mdio_write(tp, 0x05, 0xe140);
16322 gphy_val = rtl8168_mdio_read(tp, 0x06);
16323 gphy_val |= BIT_0;
16324 rtl8168_mdio_write(tp, 0x06, gphy_val);
16325 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16326 rtl8168_mdio_write(tp, 0x1f, 0x0005);
16327 for (i = 0; i < 200; i++) {
16328 udelay(100);
16329 gphy_val = rtl8168_mdio_read(tp, 0x00);
16330 if (gphy_val & BIT_7)
16331 break;
16332 }
16333 rtl8168_mdio_write(tp, 0x1f, 0x0004);
16334 rtl8168_mdio_write(tp, 0x1f, 0x0007);
16335 rtl8168_mdio_write(tp, 0x1e, 0x0023);
16336 gphy_val = rtl8168_mdio_read(tp, 0x17);
16337 gphy_val &= ~(BIT_0);
16338 gphy_val |= BIT_2;
16339 rtl8168_mdio_write(tp, 0x17, gphy_val);
16340 rtl8168_mdio_write(tp, 0x1f, 0x0002);
16341 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16342 }
16343
16344 static void
rtl8168_set_phy_mcu_8168evl_2(struct net_device * dev)16345 rtl8168_set_phy_mcu_8168evl_2(struct net_device *dev)
16346 {
16347 struct rtl8168_private *tp = netdev_priv(dev);
16348 struct pci_dev *pdev = tp->pci_dev;
16349 unsigned int gphy_val,i;
16350
16351 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16352 rtl8168_mdio_write(tp, 0x00, 0x1800);
16353 gphy_val = rtl8168_mdio_read(tp, 0x15);
16354 gphy_val &= ~(BIT_12);
16355 rtl8168_mdio_write(tp, 0x15, gphy_val);
16356 rtl8168_mdio_write(tp, 0x00, 0x4800);
16357 rtl8168_mdio_write(tp, 0x1f, 0x0007);
16358 rtl8168_mdio_write(tp, 0x1e, 0x002f);
16359 for (i = 0; i < 1000; i++) {
16360 udelay(100);
16361 gphy_val = rtl8168_mdio_read(tp, 0x1c);
16362 if ((gphy_val & 0x0080) == 0x0080)
16363 break;
16364 }
16365 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16366 rtl8168_mdio_write(tp, 0x00, 0x1800);
16367 rtl8168_mdio_write(tp, 0x1f, 0x0007);
16368 rtl8168_mdio_write(tp, 0x1e, 0x0023);
16369 for (i = 0; i < 200; i++) {
16370 udelay(100);
16371 gphy_val = rtl8168_mdio_read(tp, 0x17);
16372 if (!(gphy_val & 0x0001))
16373 break;
16374 }
16375 rtl8168_mdio_write(tp, 0x1f, 0x0005);
16376 rtl8168_mdio_write(tp, 0x05, 0xfff6);
16377 rtl8168_mdio_write(tp, 0x06, 0x0080);
16378 rtl8168_mdio_write(tp, 0x1f, 0x0007);
16379 rtl8168_mdio_write(tp, 0x1e, 0x0023);
16380 rtl8168_mdio_write(tp, 0x16, 0x0306);
16381 rtl8168_mdio_write(tp, 0x16, 0x0307);
16382 rtl8168_mdio_write(tp, 0x15, 0x00AF);
16383 rtl8168_mdio_write(tp, 0x19, 0x4060);
16384 rtl8168_mdio_write(tp, 0x15, 0x00B0);
16385 rtl8168_mdio_write(tp, 0x19, 0x7800);
16386 rtl8168_mdio_write(tp, 0x15, 0x00B1);
16387 rtl8168_mdio_write(tp, 0x19, 0x7e00);
16388 rtl8168_mdio_write(tp, 0x15, 0x00B2);
16389 rtl8168_mdio_write(tp, 0x19, 0x72B0);
16390 rtl8168_mdio_write(tp, 0x15, 0x00B3);
16391 rtl8168_mdio_write(tp, 0x19, 0x7F00);
16392 rtl8168_mdio_write(tp, 0x15, 0x00B4);
16393 rtl8168_mdio_write(tp, 0x19, 0x73B0);
16394 rtl8168_mdio_write(tp, 0x15, 0x0101);
16395 rtl8168_mdio_write(tp, 0x19, 0x0005);
16396 rtl8168_mdio_write(tp, 0x15, 0x0103);
16397 rtl8168_mdio_write(tp, 0x19, 0x0003);
16398 rtl8168_mdio_write(tp, 0x15, 0x0105);
16399 rtl8168_mdio_write(tp, 0x19, 0x30FD);
16400 rtl8168_mdio_write(tp, 0x15, 0x0106);
16401 rtl8168_mdio_write(tp, 0x19, 0x9DF7);
16402 rtl8168_mdio_write(tp, 0x15, 0x0107);
16403 rtl8168_mdio_write(tp, 0x19, 0x30C6);
16404 rtl8168_mdio_write(tp, 0x15, 0x0098);
16405 rtl8168_mdio_write(tp, 0x19, 0x7c0b);
16406 rtl8168_mdio_write(tp, 0x15, 0x0099);
16407 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
16408 rtl8168_mdio_write(tp, 0x15, 0x00eb);
16409 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
16410 rtl8168_mdio_write(tp, 0x15, 0x00f8);
16411 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
16412 rtl8168_mdio_write(tp, 0x15, 0x00fe);
16413 rtl8168_mdio_write(tp, 0x19, 0x6f0f);
16414 rtl8168_mdio_write(tp, 0x15, 0x00db);
16415 rtl8168_mdio_write(tp, 0x19, 0x6f09);
16416 rtl8168_mdio_write(tp, 0x15, 0x00dc);
16417 rtl8168_mdio_write(tp, 0x19, 0xaefd);
16418 rtl8168_mdio_write(tp, 0x15, 0x00dd);
16419 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
16420 rtl8168_mdio_write(tp, 0x15, 0x00de);
16421 rtl8168_mdio_write(tp, 0x19, 0xc60b);
16422 rtl8168_mdio_write(tp, 0x15, 0x00df);
16423 rtl8168_mdio_write(tp, 0x19, 0x00fa);
16424 rtl8168_mdio_write(tp, 0x15, 0x00e0);
16425 rtl8168_mdio_write(tp, 0x19, 0x30e1);
16426 rtl8168_mdio_write(tp, 0x15, 0x020c);
16427 rtl8168_mdio_write(tp, 0x19, 0x3224);
16428 rtl8168_mdio_write(tp, 0x15, 0x020e);
16429 rtl8168_mdio_write(tp, 0x19, 0x9813);
16430 rtl8168_mdio_write(tp, 0x15, 0x020f);
16431 rtl8168_mdio_write(tp, 0x19, 0x7801);
16432 rtl8168_mdio_write(tp, 0x15, 0x0210);
16433 rtl8168_mdio_write(tp, 0x19, 0x930f);
16434 rtl8168_mdio_write(tp, 0x15, 0x0211);
16435 rtl8168_mdio_write(tp, 0x19, 0x9206);
16436 rtl8168_mdio_write(tp, 0x15, 0x0212);
16437 rtl8168_mdio_write(tp, 0x19, 0x4002);
16438 rtl8168_mdio_write(tp, 0x15, 0x0213);
16439 rtl8168_mdio_write(tp, 0x19, 0x7800);
16440 rtl8168_mdio_write(tp, 0x15, 0x0214);
16441 rtl8168_mdio_write(tp, 0x19, 0x588f);
16442 rtl8168_mdio_write(tp, 0x15, 0x0215);
16443 rtl8168_mdio_write(tp, 0x19, 0x5520);
16444 rtl8168_mdio_write(tp, 0x15, 0x0216);
16445 rtl8168_mdio_write(tp, 0x19, 0x3224);
16446 rtl8168_mdio_write(tp, 0x15, 0x0217);
16447 rtl8168_mdio_write(tp, 0x19, 0x4002);
16448 rtl8168_mdio_write(tp, 0x15, 0x0218);
16449 rtl8168_mdio_write(tp, 0x19, 0x7800);
16450 rtl8168_mdio_write(tp, 0x15, 0x0219);
16451 rtl8168_mdio_write(tp, 0x19, 0x588d);
16452 rtl8168_mdio_write(tp, 0x15, 0x021a);
16453 rtl8168_mdio_write(tp, 0x19, 0x5540);
16454 rtl8168_mdio_write(tp, 0x15, 0x021b);
16455 rtl8168_mdio_write(tp, 0x19, 0x9e03);
16456 rtl8168_mdio_write(tp, 0x15, 0x021c);
16457 rtl8168_mdio_write(tp, 0x19, 0x7c40);
16458 rtl8168_mdio_write(tp, 0x15, 0x021d);
16459 rtl8168_mdio_write(tp, 0x19, 0x6840);
16460 rtl8168_mdio_write(tp, 0x15, 0x021e);
16461 rtl8168_mdio_write(tp, 0x19, 0x3224);
16462 rtl8168_mdio_write(tp, 0x15, 0x021f);
16463 rtl8168_mdio_write(tp, 0x19, 0x4002);
16464 rtl8168_mdio_write(tp, 0x15, 0x0220);
16465 rtl8168_mdio_write(tp, 0x19, 0x3224);
16466 rtl8168_mdio_write(tp, 0x15, 0x0221);
16467 rtl8168_mdio_write(tp, 0x19, 0x9e03);
16468 rtl8168_mdio_write(tp, 0x15, 0x0222);
16469 rtl8168_mdio_write(tp, 0x19, 0x7c40);
16470 rtl8168_mdio_write(tp, 0x15, 0x0223);
16471 rtl8168_mdio_write(tp, 0x19, 0x6840);
16472 rtl8168_mdio_write(tp, 0x15, 0x0224);
16473 rtl8168_mdio_write(tp, 0x19, 0x7800);
16474 rtl8168_mdio_write(tp, 0x15, 0x0225);
16475 rtl8168_mdio_write(tp, 0x19, 0x3231);
16476 rtl8168_mdio_write(tp, 0x15, 0x0000);
16477 rtl8168_mdio_write(tp, 0x16, 0x0306);
16478 rtl8168_mdio_write(tp, 0x16, 0x0300);
16479 rtl8168_mdio_write(tp, 0x1f, 0x0002);
16480 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16481 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16482 rtl8168_mdio_write(tp, 0x17, 0x2160);
16483 rtl8168_mdio_write(tp, 0x1f, 0x0007);
16484 rtl8168_mdio_write(tp, 0x1e, 0x0040);
16485 rtl8168_mdio_write(tp, 0x18, 0x0004);
16486 if (pdev->subsystem_vendor == 0x144d &&
16487 pdev->subsystem_device == 0xc0a6) {
16488 rtl8168_mdio_write(tp, 0x18, 0x0724);
16489 rtl8168_mdio_write(tp, 0x19, 0xfe00);
16490 rtl8168_mdio_write(tp, 0x18, 0x0734);
16491 rtl8168_mdio_write(tp, 0x19, 0xfd00);
16492 rtl8168_mdio_write(tp, 0x18, 0x1824);
16493 rtl8168_mdio_write(tp, 0x19, 0xfc00);
16494 rtl8168_mdio_write(tp, 0x18, 0x1834);
16495 rtl8168_mdio_write(tp, 0x19, 0xfd00);
16496 }
16497 rtl8168_mdio_write(tp, 0x18, 0x09d4);
16498 rtl8168_mdio_write(tp, 0x19, 0x4000);
16499 rtl8168_mdio_write(tp, 0x18, 0x09e4);
16500 rtl8168_mdio_write(tp, 0x19, 0x0800);
16501 rtl8168_mdio_write(tp, 0x18, 0x09f4);
16502 rtl8168_mdio_write(tp, 0x19, 0xff00);
16503 rtl8168_mdio_write(tp, 0x18, 0x0a04);
16504 rtl8168_mdio_write(tp, 0x19, 0x4000);
16505 rtl8168_mdio_write(tp, 0x18, 0x0a14);
16506 rtl8168_mdio_write(tp, 0x19, 0x0c00);
16507 rtl8168_mdio_write(tp, 0x18, 0x0a24);
16508 rtl8168_mdio_write(tp, 0x19, 0xff00);
16509 rtl8168_mdio_write(tp, 0x18, 0x0a74);
16510 rtl8168_mdio_write(tp, 0x19, 0xf600);
16511 rtl8168_mdio_write(tp, 0x18, 0x1a24);
16512 rtl8168_mdio_write(tp, 0x19, 0x7d00);
16513 rtl8168_mdio_write(tp, 0x18, 0x1a64);
16514 rtl8168_mdio_write(tp, 0x19, 0x0500);
16515 rtl8168_mdio_write(tp, 0x18, 0x1a74);
16516 rtl8168_mdio_write(tp, 0x19, 0x9500);
16517 rtl8168_mdio_write(tp, 0x18, 0x1a84);
16518 rtl8168_mdio_write(tp, 0x19, 0x8000);
16519 rtl8168_mdio_write(tp, 0x18, 0x1a94);
16520 rtl8168_mdio_write(tp, 0x19, 0x7d00);
16521 rtl8168_mdio_write(tp, 0x18, 0x1aa4);
16522 rtl8168_mdio_write(tp, 0x19, 0x9600);
16523 rtl8168_mdio_write(tp, 0x18, 0x1ac4);
16524 rtl8168_mdio_write(tp, 0x19, 0x4000);
16525 rtl8168_mdio_write(tp, 0x18, 0x1ad4);
16526 rtl8168_mdio_write(tp, 0x19, 0x0800);
16527 rtl8168_mdio_write(tp, 0x18, 0x1af4);
16528 rtl8168_mdio_write(tp, 0x19, 0xc400);
16529 rtl8168_mdio_write(tp, 0x18, 0x1b04);
16530 rtl8168_mdio_write(tp, 0x19, 0x4000);
16531 rtl8168_mdio_write(tp, 0x18, 0x1b14);
16532 rtl8168_mdio_write(tp, 0x19, 0x0800);
16533 rtl8168_mdio_write(tp, 0x18, 0x1b24);
16534 rtl8168_mdio_write(tp, 0x19, 0xfd00);
16535 rtl8168_mdio_write(tp, 0x18, 0x1b34);
16536 rtl8168_mdio_write(tp, 0x19, 0x4000);
16537 rtl8168_mdio_write(tp, 0x18, 0x1b44);
16538 rtl8168_mdio_write(tp, 0x19, 0x0400);
16539 rtl8168_mdio_write(tp, 0x18, 0x1b94);
16540 rtl8168_mdio_write(tp, 0x19, 0xf100);
16541 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16542 rtl8168_mdio_write(tp, 0x17, 0x2100);
16543 rtl8168_mdio_write(tp, 0x1f, 0x0007);
16544 rtl8168_mdio_write(tp, 0x1e, 0x0040);
16545 rtl8168_mdio_write(tp, 0x18, 0x0000);
16546 rtl8168_mdio_write(tp, 0x1f, 0x0000);
16547 rtl8168_mdio_write(tp, 0x1f, 0x0005);
16548 rtl8168_mdio_write(tp, 0x05, 0xfff6);
16549 rtl8168_mdio_write(tp, 0x06, 0x0080);
16550 rtl8168_mdio_write(tp, 0x05, 0x8000);
16551 rtl8168_mdio_write(tp, 0x06, 0x0280);
16552 rtl8168_mdio_write(tp, 0x06, 0x48f7);
16553 rtl8168_mdio_write(tp, 0x06, 0x00e0);
16554 rtl8168_mdio_write(tp, 0x06, 0xfff7);
16555 rtl8168_mdio_write(tp, 0x06, 0xa080);
16556 rtl8168_mdio_write(tp, 0x06, 0x02ae);
16557 rtl8168_mdio_write(tp, 0x06, 0xf602);
16558 rtl8168_mdio_write(tp, 0x06, 0x0115);
16559 rtl8168_mdio_write(tp, 0x06, 0x0201);
16560 rtl8168_mdio_write(tp, 0x06, 0x2202);
16561 rtl8168_mdio_write(tp, 0x06, 0x80a0);
16562 rtl8168_mdio_write(tp, 0x06, 0x0201);
16563 rtl8168_mdio_write(tp, 0x06, 0x3f02);
16564 rtl8168_mdio_write(tp, 0x06, 0x0159);
16565 rtl8168_mdio_write(tp, 0x06, 0x0280);
16566 rtl8168_mdio_write(tp, 0x06, 0xbd02);
16567 rtl8168_mdio_write(tp, 0x06, 0x80da);
16568 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16569 rtl8168_mdio_write(tp, 0x06, 0x88e1);
16570 rtl8168_mdio_write(tp, 0x06, 0x8b89);
16571 rtl8168_mdio_write(tp, 0x06, 0x1e01);
16572 rtl8168_mdio_write(tp, 0x06, 0xe18b);
16573 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
16574 rtl8168_mdio_write(tp, 0x06, 0x01e1);
16575 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
16576 rtl8168_mdio_write(tp, 0x06, 0x1e01);
16577 rtl8168_mdio_write(tp, 0x06, 0xe18b);
16578 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
16579 rtl8168_mdio_write(tp, 0x06, 0x01e1);
16580 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
16581 rtl8168_mdio_write(tp, 0x06, 0x1e01);
16582 rtl8168_mdio_write(tp, 0x06, 0xe18b);
16583 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
16584 rtl8168_mdio_write(tp, 0x06, 0x01a0);
16585 rtl8168_mdio_write(tp, 0x06, 0x00c7);
16586 rtl8168_mdio_write(tp, 0x06, 0xaebb);
16587 rtl8168_mdio_write(tp, 0x06, 0xd481);
16588 rtl8168_mdio_write(tp, 0x06, 0xd2e4);
16589 rtl8168_mdio_write(tp, 0x06, 0x8b92);
16590 rtl8168_mdio_write(tp, 0x06, 0xe58b);
16591 rtl8168_mdio_write(tp, 0x06, 0x93d1);
16592 rtl8168_mdio_write(tp, 0x06, 0x03bf);
16593 rtl8168_mdio_write(tp, 0x06, 0x859e);
16594 rtl8168_mdio_write(tp, 0x06, 0x0237);
16595 rtl8168_mdio_write(tp, 0x06, 0x23d1);
16596 rtl8168_mdio_write(tp, 0x06, 0x02bf);
16597 rtl8168_mdio_write(tp, 0x06, 0x85a1);
16598 rtl8168_mdio_write(tp, 0x06, 0x0237);
16599 rtl8168_mdio_write(tp, 0x06, 0x23ee);
16600 rtl8168_mdio_write(tp, 0x06, 0x8608);
16601 rtl8168_mdio_write(tp, 0x06, 0x03ee);
16602 rtl8168_mdio_write(tp, 0x06, 0x860a);
16603 rtl8168_mdio_write(tp, 0x06, 0x60ee);
16604 rtl8168_mdio_write(tp, 0x06, 0x8610);
16605 rtl8168_mdio_write(tp, 0x06, 0x00ee);
16606 rtl8168_mdio_write(tp, 0x06, 0x8611);
16607 rtl8168_mdio_write(tp, 0x06, 0x00ee);
16608 rtl8168_mdio_write(tp, 0x06, 0x8abe);
16609 rtl8168_mdio_write(tp, 0x06, 0x07ee);
16610 rtl8168_mdio_write(tp, 0x06, 0x8abf);
16611 rtl8168_mdio_write(tp, 0x06, 0x73ee);
16612 rtl8168_mdio_write(tp, 0x06, 0x8a95);
16613 rtl8168_mdio_write(tp, 0x06, 0x02bf);
16614 rtl8168_mdio_write(tp, 0x06, 0x8b88);
16615 rtl8168_mdio_write(tp, 0x06, 0xec00);
16616 rtl8168_mdio_write(tp, 0x06, 0x19a9);
16617 rtl8168_mdio_write(tp, 0x06, 0x8b90);
16618 rtl8168_mdio_write(tp, 0x06, 0xf9ee);
16619 rtl8168_mdio_write(tp, 0x06, 0xfff6);
16620 rtl8168_mdio_write(tp, 0x06, 0x00ee);
16621 rtl8168_mdio_write(tp, 0x06, 0xfff7);
16622 rtl8168_mdio_write(tp, 0x06, 0xfed1);
16623 rtl8168_mdio_write(tp, 0x06, 0x00bf);
16624 rtl8168_mdio_write(tp, 0x06, 0x8595);
16625 rtl8168_mdio_write(tp, 0x06, 0x0237);
16626 rtl8168_mdio_write(tp, 0x06, 0x23d1);
16627 rtl8168_mdio_write(tp, 0x06, 0x01bf);
16628 rtl8168_mdio_write(tp, 0x06, 0x8598);
16629 rtl8168_mdio_write(tp, 0x06, 0x0237);
16630 rtl8168_mdio_write(tp, 0x06, 0x2304);
16631 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
16632 rtl8168_mdio_write(tp, 0x06, 0x8b8a);
16633 rtl8168_mdio_write(tp, 0x06, 0xad20);
16634 rtl8168_mdio_write(tp, 0x06, 0x14ee);
16635 rtl8168_mdio_write(tp, 0x06, 0x8b8a);
16636 rtl8168_mdio_write(tp, 0x06, 0x0002);
16637 rtl8168_mdio_write(tp, 0x06, 0x1f9a);
16638 rtl8168_mdio_write(tp, 0x06, 0xe0e4);
16639 rtl8168_mdio_write(tp, 0x06, 0x26e1);
16640 rtl8168_mdio_write(tp, 0x06, 0xe427);
16641 rtl8168_mdio_write(tp, 0x06, 0xeee4);
16642 rtl8168_mdio_write(tp, 0x06, 0x2623);
16643 rtl8168_mdio_write(tp, 0x06, 0xe5e4);
16644 rtl8168_mdio_write(tp, 0x06, 0x27fc);
16645 rtl8168_mdio_write(tp, 0x06, 0x04f8);
16646 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16647 rtl8168_mdio_write(tp, 0x06, 0x8dad);
16648 rtl8168_mdio_write(tp, 0x06, 0x2014);
16649 rtl8168_mdio_write(tp, 0x06, 0xee8b);
16650 rtl8168_mdio_write(tp, 0x06, 0x8d00);
16651 rtl8168_mdio_write(tp, 0x06, 0xe08a);
16652 rtl8168_mdio_write(tp, 0x06, 0x5a78);
16653 rtl8168_mdio_write(tp, 0x06, 0x039e);
16654 rtl8168_mdio_write(tp, 0x06, 0x0902);
16655 rtl8168_mdio_write(tp, 0x06, 0x05db);
16656 rtl8168_mdio_write(tp, 0x06, 0x0282);
16657 rtl8168_mdio_write(tp, 0x06, 0x7b02);
16658 rtl8168_mdio_write(tp, 0x06, 0x3231);
16659 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16660 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
16661 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16662 rtl8168_mdio_write(tp, 0x06, 0xad20);
16663 rtl8168_mdio_write(tp, 0x06, 0x1df6);
16664 rtl8168_mdio_write(tp, 0x06, 0x20e4);
16665 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16666 rtl8168_mdio_write(tp, 0x06, 0x0281);
16667 rtl8168_mdio_write(tp, 0x06, 0x5c02);
16668 rtl8168_mdio_write(tp, 0x06, 0x2bcb);
16669 rtl8168_mdio_write(tp, 0x06, 0x022d);
16670 rtl8168_mdio_write(tp, 0x06, 0x2902);
16671 rtl8168_mdio_write(tp, 0x06, 0x03b4);
16672 rtl8168_mdio_write(tp, 0x06, 0x0285);
16673 rtl8168_mdio_write(tp, 0x06, 0x6402);
16674 rtl8168_mdio_write(tp, 0x06, 0x2eca);
16675 rtl8168_mdio_write(tp, 0x06, 0x0284);
16676 rtl8168_mdio_write(tp, 0x06, 0xcd02);
16677 rtl8168_mdio_write(tp, 0x06, 0x046f);
16678 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16679 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16680 rtl8168_mdio_write(tp, 0x06, 0x210b);
16681 rtl8168_mdio_write(tp, 0x06, 0xf621);
16682 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16683 rtl8168_mdio_write(tp, 0x06, 0x8e02);
16684 rtl8168_mdio_write(tp, 0x06, 0x8520);
16685 rtl8168_mdio_write(tp, 0x06, 0x021b);
16686 rtl8168_mdio_write(tp, 0x06, 0xe8e0);
16687 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16688 rtl8168_mdio_write(tp, 0x06, 0xad22);
16689 rtl8168_mdio_write(tp, 0x06, 0x05f6);
16690 rtl8168_mdio_write(tp, 0x06, 0x22e4);
16691 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16692 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16693 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16694 rtl8168_mdio_write(tp, 0x06, 0x2308);
16695 rtl8168_mdio_write(tp, 0x06, 0xf623);
16696 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16697 rtl8168_mdio_write(tp, 0x06, 0x8e02);
16698 rtl8168_mdio_write(tp, 0x06, 0x311c);
16699 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16700 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16701 rtl8168_mdio_write(tp, 0x06, 0x2405);
16702 rtl8168_mdio_write(tp, 0x06, 0xf624);
16703 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16704 rtl8168_mdio_write(tp, 0x06, 0x8ee0);
16705 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16706 rtl8168_mdio_write(tp, 0x06, 0xad25);
16707 rtl8168_mdio_write(tp, 0x06, 0x05f6);
16708 rtl8168_mdio_write(tp, 0x06, 0x25e4);
16709 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
16710 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16711 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16712 rtl8168_mdio_write(tp, 0x06, 0x2608);
16713 rtl8168_mdio_write(tp, 0x06, 0xf626);
16714 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16715 rtl8168_mdio_write(tp, 0x06, 0x8e02);
16716 rtl8168_mdio_write(tp, 0x06, 0x2df5);
16717 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16718 rtl8168_mdio_write(tp, 0x06, 0x8ead);
16719 rtl8168_mdio_write(tp, 0x06, 0x2705);
16720 rtl8168_mdio_write(tp, 0x06, 0xf627);
16721 rtl8168_mdio_write(tp, 0x06, 0xe48b);
16722 rtl8168_mdio_write(tp, 0x06, 0x8e02);
16723 rtl8168_mdio_write(tp, 0x06, 0x037a);
16724 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16725 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
16726 rtl8168_mdio_write(tp, 0x06, 0xfaef);
16727 rtl8168_mdio_write(tp, 0x06, 0x69e0);
16728 rtl8168_mdio_write(tp, 0x06, 0x8b87);
16729 rtl8168_mdio_write(tp, 0x06, 0xad20);
16730 rtl8168_mdio_write(tp, 0x06, 0x65d2);
16731 rtl8168_mdio_write(tp, 0x06, 0x00bf);
16732 rtl8168_mdio_write(tp, 0x06, 0x2fe9);
16733 rtl8168_mdio_write(tp, 0x06, 0x0236);
16734 rtl8168_mdio_write(tp, 0x06, 0xf61e);
16735 rtl8168_mdio_write(tp, 0x06, 0x21bf);
16736 rtl8168_mdio_write(tp, 0x06, 0x2ff5);
16737 rtl8168_mdio_write(tp, 0x06, 0x0236);
16738 rtl8168_mdio_write(tp, 0x06, 0xf60c);
16739 rtl8168_mdio_write(tp, 0x06, 0x111e);
16740 rtl8168_mdio_write(tp, 0x06, 0x21bf);
16741 rtl8168_mdio_write(tp, 0x06, 0x2ff8);
16742 rtl8168_mdio_write(tp, 0x06, 0x0236);
16743 rtl8168_mdio_write(tp, 0x06, 0xf60c);
16744 rtl8168_mdio_write(tp, 0x06, 0x121e);
16745 rtl8168_mdio_write(tp, 0x06, 0x21bf);
16746 rtl8168_mdio_write(tp, 0x06, 0x2ffb);
16747 rtl8168_mdio_write(tp, 0x06, 0x0236);
16748 rtl8168_mdio_write(tp, 0x06, 0xf60c);
16749 rtl8168_mdio_write(tp, 0x06, 0x131e);
16750 rtl8168_mdio_write(tp, 0x06, 0x21bf);
16751 rtl8168_mdio_write(tp, 0x06, 0x1f97);
16752 rtl8168_mdio_write(tp, 0x06, 0x0236);
16753 rtl8168_mdio_write(tp, 0x06, 0xf60c);
16754 rtl8168_mdio_write(tp, 0x06, 0x141e);
16755 rtl8168_mdio_write(tp, 0x06, 0x21bf);
16756 rtl8168_mdio_write(tp, 0x06, 0x859b);
16757 rtl8168_mdio_write(tp, 0x06, 0x0236);
16758 rtl8168_mdio_write(tp, 0x06, 0xf60c);
16759 rtl8168_mdio_write(tp, 0x06, 0x161e);
16760 rtl8168_mdio_write(tp, 0x06, 0x21e0);
16761 rtl8168_mdio_write(tp, 0x06, 0x8a8c);
16762 rtl8168_mdio_write(tp, 0x06, 0x1f02);
16763 rtl8168_mdio_write(tp, 0x06, 0x9e22);
16764 rtl8168_mdio_write(tp, 0x06, 0xe68a);
16765 rtl8168_mdio_write(tp, 0x06, 0x8cad);
16766 rtl8168_mdio_write(tp, 0x06, 0x3114);
16767 rtl8168_mdio_write(tp, 0x06, 0xad30);
16768 rtl8168_mdio_write(tp, 0x06, 0x11ef);
16769 rtl8168_mdio_write(tp, 0x06, 0x0258);
16770 rtl8168_mdio_write(tp, 0x06, 0x0c9e);
16771 rtl8168_mdio_write(tp, 0x06, 0x07ad);
16772 rtl8168_mdio_write(tp, 0x06, 0x3608);
16773 rtl8168_mdio_write(tp, 0x06, 0x5a30);
16774 rtl8168_mdio_write(tp, 0x06, 0x9f04);
16775 rtl8168_mdio_write(tp, 0x06, 0xd101);
16776 rtl8168_mdio_write(tp, 0x06, 0xae02);
16777 rtl8168_mdio_write(tp, 0x06, 0xd100);
16778 rtl8168_mdio_write(tp, 0x06, 0xbf2f);
16779 rtl8168_mdio_write(tp, 0x06, 0xf202);
16780 rtl8168_mdio_write(tp, 0x06, 0x3723);
16781 rtl8168_mdio_write(tp, 0x06, 0xef96);
16782 rtl8168_mdio_write(tp, 0x06, 0xfefd);
16783 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16784 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
16785 rtl8168_mdio_write(tp, 0x06, 0xface);
16786 rtl8168_mdio_write(tp, 0x06, 0xfaef);
16787 rtl8168_mdio_write(tp, 0x06, 0x69fa);
16788 rtl8168_mdio_write(tp, 0x06, 0xd401);
16789 rtl8168_mdio_write(tp, 0x06, 0x55b4);
16790 rtl8168_mdio_write(tp, 0x06, 0xfebf);
16791 rtl8168_mdio_write(tp, 0x06, 0x85a7);
16792 rtl8168_mdio_write(tp, 0x06, 0x0236);
16793 rtl8168_mdio_write(tp, 0x06, 0xf6ac);
16794 rtl8168_mdio_write(tp, 0x06, 0x280b);
16795 rtl8168_mdio_write(tp, 0x06, 0xbf85);
16796 rtl8168_mdio_write(tp, 0x06, 0xa402);
16797 rtl8168_mdio_write(tp, 0x06, 0x36f6);
16798 rtl8168_mdio_write(tp, 0x06, 0xac28);
16799 rtl8168_mdio_write(tp, 0x06, 0x49ae);
16800 rtl8168_mdio_write(tp, 0x06, 0x64bf);
16801 rtl8168_mdio_write(tp, 0x06, 0x85a4);
16802 rtl8168_mdio_write(tp, 0x06, 0x0236);
16803 rtl8168_mdio_write(tp, 0x06, 0xf6ac);
16804 rtl8168_mdio_write(tp, 0x06, 0x285b);
16805 rtl8168_mdio_write(tp, 0x06, 0xd000);
16806 rtl8168_mdio_write(tp, 0x06, 0x0282);
16807 rtl8168_mdio_write(tp, 0x06, 0x60ac);
16808 rtl8168_mdio_write(tp, 0x06, 0x2105);
16809 rtl8168_mdio_write(tp, 0x06, 0xac22);
16810 rtl8168_mdio_write(tp, 0x06, 0x02ae);
16811 rtl8168_mdio_write(tp, 0x06, 0x4ebf);
16812 rtl8168_mdio_write(tp, 0x06, 0xe0c4);
16813 rtl8168_mdio_write(tp, 0x06, 0xbe86);
16814 rtl8168_mdio_write(tp, 0x06, 0x14d2);
16815 rtl8168_mdio_write(tp, 0x06, 0x04d8);
16816 rtl8168_mdio_write(tp, 0x06, 0x19d9);
16817 rtl8168_mdio_write(tp, 0x06, 0x1907);
16818 rtl8168_mdio_write(tp, 0x06, 0xdc19);
16819 rtl8168_mdio_write(tp, 0x06, 0xdd19);
16820 rtl8168_mdio_write(tp, 0x06, 0x0789);
16821 rtl8168_mdio_write(tp, 0x06, 0x89ef);
16822 rtl8168_mdio_write(tp, 0x06, 0x645e);
16823 rtl8168_mdio_write(tp, 0x06, 0x07ff);
16824 rtl8168_mdio_write(tp, 0x06, 0x0d65);
16825 rtl8168_mdio_write(tp, 0x06, 0x5cf8);
16826 rtl8168_mdio_write(tp, 0x06, 0x001e);
16827 rtl8168_mdio_write(tp, 0x06, 0x46dc);
16828 rtl8168_mdio_write(tp, 0x06, 0x19dd);
16829 rtl8168_mdio_write(tp, 0x06, 0x19b2);
16830 rtl8168_mdio_write(tp, 0x06, 0xe2d4);
16831 rtl8168_mdio_write(tp, 0x06, 0x0001);
16832 rtl8168_mdio_write(tp, 0x06, 0xbf85);
16833 rtl8168_mdio_write(tp, 0x06, 0xa402);
16834 rtl8168_mdio_write(tp, 0x06, 0x3723);
16835 rtl8168_mdio_write(tp, 0x06, 0xae1d);
16836 rtl8168_mdio_write(tp, 0x06, 0xbee0);
16837 rtl8168_mdio_write(tp, 0x06, 0xc4bf);
16838 rtl8168_mdio_write(tp, 0x06, 0x8614);
16839 rtl8168_mdio_write(tp, 0x06, 0xd204);
16840 rtl8168_mdio_write(tp, 0x06, 0xd819);
16841 rtl8168_mdio_write(tp, 0x06, 0xd919);
16842 rtl8168_mdio_write(tp, 0x06, 0x07dc);
16843 rtl8168_mdio_write(tp, 0x06, 0x19dd);
16844 rtl8168_mdio_write(tp, 0x06, 0x1907);
16845 rtl8168_mdio_write(tp, 0x06, 0xb2f4);
16846 rtl8168_mdio_write(tp, 0x06, 0xd400);
16847 rtl8168_mdio_write(tp, 0x06, 0x00bf);
16848 rtl8168_mdio_write(tp, 0x06, 0x85a4);
16849 rtl8168_mdio_write(tp, 0x06, 0x0237);
16850 rtl8168_mdio_write(tp, 0x06, 0x23fe);
16851 rtl8168_mdio_write(tp, 0x06, 0xef96);
16852 rtl8168_mdio_write(tp, 0x06, 0xfec6);
16853 rtl8168_mdio_write(tp, 0x06, 0xfefd);
16854 rtl8168_mdio_write(tp, 0x06, 0xfc05);
16855 rtl8168_mdio_write(tp, 0x06, 0xf9e2);
16856 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
16857 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
16858 rtl8168_mdio_write(tp, 0x06, 0xeb5a);
16859 rtl8168_mdio_write(tp, 0x06, 0x070c);
16860 rtl8168_mdio_write(tp, 0x06, 0x031e);
16861 rtl8168_mdio_write(tp, 0x06, 0x20e6);
16862 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
16863 rtl8168_mdio_write(tp, 0x06, 0xe7e0);
16864 rtl8168_mdio_write(tp, 0x06, 0xebe0);
16865 rtl8168_mdio_write(tp, 0x06, 0xe0fc);
16866 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
16867 rtl8168_mdio_write(tp, 0x06, 0xfdfd);
16868 rtl8168_mdio_write(tp, 0x06, 0x04f8);
16869 rtl8168_mdio_write(tp, 0x06, 0xf9e0);
16870 rtl8168_mdio_write(tp, 0x06, 0x8b81);
16871 rtl8168_mdio_write(tp, 0x06, 0xac26);
16872 rtl8168_mdio_write(tp, 0x06, 0x1ae0);
16873 rtl8168_mdio_write(tp, 0x06, 0x8b81);
16874 rtl8168_mdio_write(tp, 0x06, 0xac21);
16875 rtl8168_mdio_write(tp, 0x06, 0x14e0);
16876 rtl8168_mdio_write(tp, 0x06, 0x8b85);
16877 rtl8168_mdio_write(tp, 0x06, 0xac20);
16878 rtl8168_mdio_write(tp, 0x06, 0x0ee0);
16879 rtl8168_mdio_write(tp, 0x06, 0x8b85);
16880 rtl8168_mdio_write(tp, 0x06, 0xac23);
16881 rtl8168_mdio_write(tp, 0x06, 0x08e0);
16882 rtl8168_mdio_write(tp, 0x06, 0x8b87);
16883 rtl8168_mdio_write(tp, 0x06, 0xac24);
16884 rtl8168_mdio_write(tp, 0x06, 0x02ae);
16885 rtl8168_mdio_write(tp, 0x06, 0x3802);
16886 rtl8168_mdio_write(tp, 0x06, 0x1ab5);
16887 rtl8168_mdio_write(tp, 0x06, 0xeee4);
16888 rtl8168_mdio_write(tp, 0x06, 0x1c04);
16889 rtl8168_mdio_write(tp, 0x06, 0xeee4);
16890 rtl8168_mdio_write(tp, 0x06, 0x1d04);
16891 rtl8168_mdio_write(tp, 0x06, 0xe2e0);
16892 rtl8168_mdio_write(tp, 0x06, 0x7ce3);
16893 rtl8168_mdio_write(tp, 0x06, 0xe07d);
16894 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
16895 rtl8168_mdio_write(tp, 0x06, 0x38e1);
16896 rtl8168_mdio_write(tp, 0x06, 0xe039);
16897 rtl8168_mdio_write(tp, 0x06, 0xad2e);
16898 rtl8168_mdio_write(tp, 0x06, 0x1bad);
16899 rtl8168_mdio_write(tp, 0x06, 0x390d);
16900 rtl8168_mdio_write(tp, 0x06, 0xd101);
16901 rtl8168_mdio_write(tp, 0x06, 0xbf21);
16902 rtl8168_mdio_write(tp, 0x06, 0xd502);
16903 rtl8168_mdio_write(tp, 0x06, 0x3723);
16904 rtl8168_mdio_write(tp, 0x06, 0x0282);
16905 rtl8168_mdio_write(tp, 0x06, 0xd8ae);
16906 rtl8168_mdio_write(tp, 0x06, 0x0bac);
16907 rtl8168_mdio_write(tp, 0x06, 0x3802);
16908 rtl8168_mdio_write(tp, 0x06, 0xae06);
16909 rtl8168_mdio_write(tp, 0x06, 0x0283);
16910 rtl8168_mdio_write(tp, 0x06, 0x1802);
16911 rtl8168_mdio_write(tp, 0x06, 0x8360);
16912 rtl8168_mdio_write(tp, 0x06, 0x021a);
16913 rtl8168_mdio_write(tp, 0x06, 0xc6fd);
16914 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16915 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
16916 rtl8168_mdio_write(tp, 0x06, 0x8af4);
16917 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16918 rtl8168_mdio_write(tp, 0x06, 0x81ad);
16919 rtl8168_mdio_write(tp, 0x06, 0x2605);
16920 rtl8168_mdio_write(tp, 0x06, 0x0222);
16921 rtl8168_mdio_write(tp, 0x06, 0xa4f7);
16922 rtl8168_mdio_write(tp, 0x06, 0x28e0);
16923 rtl8168_mdio_write(tp, 0x06, 0x8b81);
16924 rtl8168_mdio_write(tp, 0x06, 0xad21);
16925 rtl8168_mdio_write(tp, 0x06, 0x0502);
16926 rtl8168_mdio_write(tp, 0x06, 0x23a9);
16927 rtl8168_mdio_write(tp, 0x06, 0xf729);
16928 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16929 rtl8168_mdio_write(tp, 0x06, 0x85ad);
16930 rtl8168_mdio_write(tp, 0x06, 0x2005);
16931 rtl8168_mdio_write(tp, 0x06, 0x0214);
16932 rtl8168_mdio_write(tp, 0x06, 0xabf7);
16933 rtl8168_mdio_write(tp, 0x06, 0x2ae0);
16934 rtl8168_mdio_write(tp, 0x06, 0x8b85);
16935 rtl8168_mdio_write(tp, 0x06, 0xad23);
16936 rtl8168_mdio_write(tp, 0x06, 0x0502);
16937 rtl8168_mdio_write(tp, 0x06, 0x12e7);
16938 rtl8168_mdio_write(tp, 0x06, 0xf72b);
16939 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16940 rtl8168_mdio_write(tp, 0x06, 0x87ad);
16941 rtl8168_mdio_write(tp, 0x06, 0x2405);
16942 rtl8168_mdio_write(tp, 0x06, 0x0283);
16943 rtl8168_mdio_write(tp, 0x06, 0xbcf7);
16944 rtl8168_mdio_write(tp, 0x06, 0x2ce5);
16945 rtl8168_mdio_write(tp, 0x06, 0x8af4);
16946 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16947 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
16948 rtl8168_mdio_write(tp, 0x06, 0x8b81);
16949 rtl8168_mdio_write(tp, 0x06, 0xad26);
16950 rtl8168_mdio_write(tp, 0x06, 0x0302);
16951 rtl8168_mdio_write(tp, 0x06, 0x21e5);
16952 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16953 rtl8168_mdio_write(tp, 0x06, 0x81ad);
16954 rtl8168_mdio_write(tp, 0x06, 0x2109);
16955 rtl8168_mdio_write(tp, 0x06, 0xe08a);
16956 rtl8168_mdio_write(tp, 0x06, 0xf4ac);
16957 rtl8168_mdio_write(tp, 0x06, 0x2003);
16958 rtl8168_mdio_write(tp, 0x06, 0x0223);
16959 rtl8168_mdio_write(tp, 0x06, 0x98e0);
16960 rtl8168_mdio_write(tp, 0x06, 0x8b85);
16961 rtl8168_mdio_write(tp, 0x06, 0xad20);
16962 rtl8168_mdio_write(tp, 0x06, 0x09e0);
16963 rtl8168_mdio_write(tp, 0x06, 0x8af4);
16964 rtl8168_mdio_write(tp, 0x06, 0xac21);
16965 rtl8168_mdio_write(tp, 0x06, 0x0302);
16966 rtl8168_mdio_write(tp, 0x06, 0x13fb);
16967 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16968 rtl8168_mdio_write(tp, 0x06, 0x85ad);
16969 rtl8168_mdio_write(tp, 0x06, 0x2309);
16970 rtl8168_mdio_write(tp, 0x06, 0xe08a);
16971 rtl8168_mdio_write(tp, 0x06, 0xf4ac);
16972 rtl8168_mdio_write(tp, 0x06, 0x2203);
16973 rtl8168_mdio_write(tp, 0x06, 0x0212);
16974 rtl8168_mdio_write(tp, 0x06, 0xfae0);
16975 rtl8168_mdio_write(tp, 0x06, 0x8b87);
16976 rtl8168_mdio_write(tp, 0x06, 0xad24);
16977 rtl8168_mdio_write(tp, 0x06, 0x09e0);
16978 rtl8168_mdio_write(tp, 0x06, 0x8af4);
16979 rtl8168_mdio_write(tp, 0x06, 0xac23);
16980 rtl8168_mdio_write(tp, 0x06, 0x0302);
16981 rtl8168_mdio_write(tp, 0x06, 0x83c1);
16982 rtl8168_mdio_write(tp, 0x06, 0xfc04);
16983 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
16984 rtl8168_mdio_write(tp, 0x06, 0x8af4);
16985 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16986 rtl8168_mdio_write(tp, 0x06, 0x81ad);
16987 rtl8168_mdio_write(tp, 0x06, 0x2608);
16988 rtl8168_mdio_write(tp, 0x06, 0xe083);
16989 rtl8168_mdio_write(tp, 0x06, 0xd2ad);
16990 rtl8168_mdio_write(tp, 0x06, 0x2502);
16991 rtl8168_mdio_write(tp, 0x06, 0xf628);
16992 rtl8168_mdio_write(tp, 0x06, 0xe08b);
16993 rtl8168_mdio_write(tp, 0x06, 0x81ad);
16994 rtl8168_mdio_write(tp, 0x06, 0x210a);
16995 rtl8168_mdio_write(tp, 0x06, 0xe084);
16996 rtl8168_mdio_write(tp, 0x06, 0x0af6);
16997 rtl8168_mdio_write(tp, 0x06, 0x27a0);
16998 rtl8168_mdio_write(tp, 0x06, 0x0502);
16999 rtl8168_mdio_write(tp, 0x06, 0xf629);
17000 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17001 rtl8168_mdio_write(tp, 0x06, 0x85ad);
17002 rtl8168_mdio_write(tp, 0x06, 0x2008);
17003 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17004 rtl8168_mdio_write(tp, 0x06, 0xe8ad);
17005 rtl8168_mdio_write(tp, 0x06, 0x2102);
17006 rtl8168_mdio_write(tp, 0x06, 0xf62a);
17007 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17008 rtl8168_mdio_write(tp, 0x06, 0x85ad);
17009 rtl8168_mdio_write(tp, 0x06, 0x2308);
17010 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17011 rtl8168_mdio_write(tp, 0x06, 0x20a0);
17012 rtl8168_mdio_write(tp, 0x06, 0x0302);
17013 rtl8168_mdio_write(tp, 0x06, 0xf62b);
17014 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17015 rtl8168_mdio_write(tp, 0x06, 0x87ad);
17016 rtl8168_mdio_write(tp, 0x06, 0x2408);
17017 rtl8168_mdio_write(tp, 0x06, 0xe086);
17018 rtl8168_mdio_write(tp, 0x06, 0x02a0);
17019 rtl8168_mdio_write(tp, 0x06, 0x0302);
17020 rtl8168_mdio_write(tp, 0x06, 0xf62c);
17021 rtl8168_mdio_write(tp, 0x06, 0xe58a);
17022 rtl8168_mdio_write(tp, 0x06, 0xf4a1);
17023 rtl8168_mdio_write(tp, 0x06, 0x0008);
17024 rtl8168_mdio_write(tp, 0x06, 0xd100);
17025 rtl8168_mdio_write(tp, 0x06, 0xbf21);
17026 rtl8168_mdio_write(tp, 0x06, 0xd502);
17027 rtl8168_mdio_write(tp, 0x06, 0x3723);
17028 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17029 rtl8168_mdio_write(tp, 0x06, 0xee86);
17030 rtl8168_mdio_write(tp, 0x06, 0x0200);
17031 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17032 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17033 rtl8168_mdio_write(tp, 0x06, 0x87ad);
17034 rtl8168_mdio_write(tp, 0x06, 0x241e);
17035 rtl8168_mdio_write(tp, 0x06, 0xe086);
17036 rtl8168_mdio_write(tp, 0x06, 0x02a0);
17037 rtl8168_mdio_write(tp, 0x06, 0x0005);
17038 rtl8168_mdio_write(tp, 0x06, 0x0283);
17039 rtl8168_mdio_write(tp, 0x06, 0xe8ae);
17040 rtl8168_mdio_write(tp, 0x06, 0xf5a0);
17041 rtl8168_mdio_write(tp, 0x06, 0x0105);
17042 rtl8168_mdio_write(tp, 0x06, 0x0283);
17043 rtl8168_mdio_write(tp, 0x06, 0xf8ae);
17044 rtl8168_mdio_write(tp, 0x06, 0x0ba0);
17045 rtl8168_mdio_write(tp, 0x06, 0x0205);
17046 rtl8168_mdio_write(tp, 0x06, 0x0284);
17047 rtl8168_mdio_write(tp, 0x06, 0x14ae);
17048 rtl8168_mdio_write(tp, 0x06, 0x03a0);
17049 rtl8168_mdio_write(tp, 0x06, 0x0300);
17050 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17051 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
17052 rtl8168_mdio_write(tp, 0x06, 0xef69);
17053 rtl8168_mdio_write(tp, 0x06, 0x0284);
17054 rtl8168_mdio_write(tp, 0x06, 0x2bee);
17055 rtl8168_mdio_write(tp, 0x06, 0x8602);
17056 rtl8168_mdio_write(tp, 0x06, 0x01ef);
17057 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17058 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17059 rtl8168_mdio_write(tp, 0x06, 0xf8ee);
17060 rtl8168_mdio_write(tp, 0x06, 0x8609);
17061 rtl8168_mdio_write(tp, 0x06, 0x0002);
17062 rtl8168_mdio_write(tp, 0x06, 0x8461);
17063 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17064 rtl8168_mdio_write(tp, 0x06, 0xae10);
17065 rtl8168_mdio_write(tp, 0x06, 0x0000);
17066 rtl8168_mdio_write(tp, 0x06, 0x0000);
17067 rtl8168_mdio_write(tp, 0x06, 0x0000);
17068 rtl8168_mdio_write(tp, 0x06, 0x0000);
17069 rtl8168_mdio_write(tp, 0x06, 0x0000);
17070 rtl8168_mdio_write(tp, 0x06, 0x0000);
17071 rtl8168_mdio_write(tp, 0x06, 0x0000);
17072 rtl8168_mdio_write(tp, 0x06, 0x0000);
17073 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
17074 rtl8168_mdio_write(tp, 0x06, 0x8608);
17075 rtl8168_mdio_write(tp, 0x06, 0xe186);
17076 rtl8168_mdio_write(tp, 0x06, 0x091f);
17077 rtl8168_mdio_write(tp, 0x06, 0x019e);
17078 rtl8168_mdio_write(tp, 0x06, 0x0611);
17079 rtl8168_mdio_write(tp, 0x06, 0xe586);
17080 rtl8168_mdio_write(tp, 0x06, 0x09ae);
17081 rtl8168_mdio_write(tp, 0x06, 0x04ee);
17082 rtl8168_mdio_write(tp, 0x06, 0x8602);
17083 rtl8168_mdio_write(tp, 0x06, 0x01fc);
17084 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17085 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
17086 rtl8168_mdio_write(tp, 0x06, 0xef69);
17087 rtl8168_mdio_write(tp, 0x06, 0xfbbf);
17088 rtl8168_mdio_write(tp, 0x06, 0x8604);
17089 rtl8168_mdio_write(tp, 0x06, 0xef79);
17090 rtl8168_mdio_write(tp, 0x06, 0xd200);
17091 rtl8168_mdio_write(tp, 0x06, 0xd400);
17092 rtl8168_mdio_write(tp, 0x06, 0x221e);
17093 rtl8168_mdio_write(tp, 0x06, 0x02bf);
17094 rtl8168_mdio_write(tp, 0x06, 0x2fec);
17095 rtl8168_mdio_write(tp, 0x06, 0x0237);
17096 rtl8168_mdio_write(tp, 0x06, 0x23bf);
17097 rtl8168_mdio_write(tp, 0x06, 0x13f2);
17098 rtl8168_mdio_write(tp, 0x06, 0x0236);
17099 rtl8168_mdio_write(tp, 0x06, 0xf60d);
17100 rtl8168_mdio_write(tp, 0x06, 0x4559);
17101 rtl8168_mdio_write(tp, 0x06, 0x1fef);
17102 rtl8168_mdio_write(tp, 0x06, 0x97dd);
17103 rtl8168_mdio_write(tp, 0x06, 0xd308);
17104 rtl8168_mdio_write(tp, 0x06, 0x1a93);
17105 rtl8168_mdio_write(tp, 0x06, 0xdd12);
17106 rtl8168_mdio_write(tp, 0x06, 0x17a2);
17107 rtl8168_mdio_write(tp, 0x06, 0x04de);
17108 rtl8168_mdio_write(tp, 0x06, 0xffef);
17109 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17110 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
17111 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17112 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
17113 rtl8168_mdio_write(tp, 0x06, 0xef69);
17114 rtl8168_mdio_write(tp, 0x06, 0xfbee);
17115 rtl8168_mdio_write(tp, 0x06, 0x8602);
17116 rtl8168_mdio_write(tp, 0x06, 0x03d5);
17117 rtl8168_mdio_write(tp, 0x06, 0x0080);
17118 rtl8168_mdio_write(tp, 0x06, 0xbf86);
17119 rtl8168_mdio_write(tp, 0x06, 0x04ef);
17120 rtl8168_mdio_write(tp, 0x06, 0x79ef);
17121 rtl8168_mdio_write(tp, 0x06, 0x45bf);
17122 rtl8168_mdio_write(tp, 0x06, 0x2fec);
17123 rtl8168_mdio_write(tp, 0x06, 0x0237);
17124 rtl8168_mdio_write(tp, 0x06, 0x23bf);
17125 rtl8168_mdio_write(tp, 0x06, 0x13f2);
17126 rtl8168_mdio_write(tp, 0x06, 0x0236);
17127 rtl8168_mdio_write(tp, 0x06, 0xf6ad);
17128 rtl8168_mdio_write(tp, 0x06, 0x2702);
17129 rtl8168_mdio_write(tp, 0x06, 0x78ff);
17130 rtl8168_mdio_write(tp, 0x06, 0xe186);
17131 rtl8168_mdio_write(tp, 0x06, 0x0a1b);
17132 rtl8168_mdio_write(tp, 0x06, 0x01aa);
17133 rtl8168_mdio_write(tp, 0x06, 0x2eef);
17134 rtl8168_mdio_write(tp, 0x06, 0x97d9);
17135 rtl8168_mdio_write(tp, 0x06, 0x7900);
17136 rtl8168_mdio_write(tp, 0x06, 0x9e2b);
17137 rtl8168_mdio_write(tp, 0x06, 0x81dd);
17138 rtl8168_mdio_write(tp, 0x06, 0xbf85);
17139 rtl8168_mdio_write(tp, 0x06, 0xad02);
17140 rtl8168_mdio_write(tp, 0x06, 0x3723);
17141 rtl8168_mdio_write(tp, 0x06, 0xd101);
17142 rtl8168_mdio_write(tp, 0x06, 0xef02);
17143 rtl8168_mdio_write(tp, 0x06, 0x100c);
17144 rtl8168_mdio_write(tp, 0x06, 0x11b0);
17145 rtl8168_mdio_write(tp, 0x06, 0xfc0d);
17146 rtl8168_mdio_write(tp, 0x06, 0x11bf);
17147 rtl8168_mdio_write(tp, 0x06, 0x85aa);
17148 rtl8168_mdio_write(tp, 0x06, 0x0237);
17149 rtl8168_mdio_write(tp, 0x06, 0x23d1);
17150 rtl8168_mdio_write(tp, 0x06, 0x00bf);
17151 rtl8168_mdio_write(tp, 0x06, 0x85aa);
17152 rtl8168_mdio_write(tp, 0x06, 0x0237);
17153 rtl8168_mdio_write(tp, 0x06, 0x23ee);
17154 rtl8168_mdio_write(tp, 0x06, 0x8602);
17155 rtl8168_mdio_write(tp, 0x06, 0x02ae);
17156 rtl8168_mdio_write(tp, 0x06, 0x0413);
17157 rtl8168_mdio_write(tp, 0x06, 0xa38b);
17158 rtl8168_mdio_write(tp, 0x06, 0xb4d3);
17159 rtl8168_mdio_write(tp, 0x06, 0x8012);
17160 rtl8168_mdio_write(tp, 0x06, 0x17a2);
17161 rtl8168_mdio_write(tp, 0x06, 0x04ad);
17162 rtl8168_mdio_write(tp, 0x06, 0xffef);
17163 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17164 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
17165 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17166 rtl8168_mdio_write(tp, 0x06, 0xf9e0);
17167 rtl8168_mdio_write(tp, 0x06, 0x8b85);
17168 rtl8168_mdio_write(tp, 0x06, 0xad25);
17169 rtl8168_mdio_write(tp, 0x06, 0x48e0);
17170 rtl8168_mdio_write(tp, 0x06, 0x8a96);
17171 rtl8168_mdio_write(tp, 0x06, 0xe18a);
17172 rtl8168_mdio_write(tp, 0x06, 0x977c);
17173 rtl8168_mdio_write(tp, 0x06, 0x0000);
17174 rtl8168_mdio_write(tp, 0x06, 0x9e35);
17175 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17176 rtl8168_mdio_write(tp, 0x06, 0x9600);
17177 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17178 rtl8168_mdio_write(tp, 0x06, 0x9700);
17179 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17180 rtl8168_mdio_write(tp, 0x06, 0xbee1);
17181 rtl8168_mdio_write(tp, 0x06, 0x8abf);
17182 rtl8168_mdio_write(tp, 0x06, 0xe286);
17183 rtl8168_mdio_write(tp, 0x06, 0x10e3);
17184 rtl8168_mdio_write(tp, 0x06, 0x8611);
17185 rtl8168_mdio_write(tp, 0x06, 0x0236);
17186 rtl8168_mdio_write(tp, 0x06, 0x1aad);
17187 rtl8168_mdio_write(tp, 0x06, 0x2012);
17188 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17189 rtl8168_mdio_write(tp, 0x06, 0x9603);
17190 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17191 rtl8168_mdio_write(tp, 0x06, 0x97b7);
17192 rtl8168_mdio_write(tp, 0x06, 0xee86);
17193 rtl8168_mdio_write(tp, 0x06, 0x1000);
17194 rtl8168_mdio_write(tp, 0x06, 0xee86);
17195 rtl8168_mdio_write(tp, 0x06, 0x1100);
17196 rtl8168_mdio_write(tp, 0x06, 0xae11);
17197 rtl8168_mdio_write(tp, 0x06, 0x15e6);
17198 rtl8168_mdio_write(tp, 0x06, 0x8610);
17199 rtl8168_mdio_write(tp, 0x06, 0xe786);
17200 rtl8168_mdio_write(tp, 0x06, 0x11ae);
17201 rtl8168_mdio_write(tp, 0x06, 0x08ee);
17202 rtl8168_mdio_write(tp, 0x06, 0x8610);
17203 rtl8168_mdio_write(tp, 0x06, 0x00ee);
17204 rtl8168_mdio_write(tp, 0x06, 0x8611);
17205 rtl8168_mdio_write(tp, 0x06, 0x00fd);
17206 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17207 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
17208 rtl8168_mdio_write(tp, 0x06, 0xef69);
17209 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
17210 rtl8168_mdio_write(tp, 0x06, 0x00e1);
17211 rtl8168_mdio_write(tp, 0x06, 0xe001);
17212 rtl8168_mdio_write(tp, 0x06, 0xad27);
17213 rtl8168_mdio_write(tp, 0x06, 0x32e0);
17214 rtl8168_mdio_write(tp, 0x06, 0x8b40);
17215 rtl8168_mdio_write(tp, 0x06, 0xf720);
17216 rtl8168_mdio_write(tp, 0x06, 0xe48b);
17217 rtl8168_mdio_write(tp, 0x06, 0x40bf);
17218 rtl8168_mdio_write(tp, 0x06, 0x31f5);
17219 rtl8168_mdio_write(tp, 0x06, 0x0236);
17220 rtl8168_mdio_write(tp, 0x06, 0xf6ad);
17221 rtl8168_mdio_write(tp, 0x06, 0x2821);
17222 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
17223 rtl8168_mdio_write(tp, 0x06, 0x20e1);
17224 rtl8168_mdio_write(tp, 0x06, 0xe021);
17225 rtl8168_mdio_write(tp, 0x06, 0xad20);
17226 rtl8168_mdio_write(tp, 0x06, 0x18e0);
17227 rtl8168_mdio_write(tp, 0x06, 0x8b40);
17228 rtl8168_mdio_write(tp, 0x06, 0xf620);
17229 rtl8168_mdio_write(tp, 0x06, 0xe48b);
17230 rtl8168_mdio_write(tp, 0x06, 0x40ee);
17231 rtl8168_mdio_write(tp, 0x06, 0x8b3b);
17232 rtl8168_mdio_write(tp, 0x06, 0xffe0);
17233 rtl8168_mdio_write(tp, 0x06, 0x8a8a);
17234 rtl8168_mdio_write(tp, 0x06, 0xe18a);
17235 rtl8168_mdio_write(tp, 0x06, 0x8be4);
17236 rtl8168_mdio_write(tp, 0x06, 0xe000);
17237 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
17238 rtl8168_mdio_write(tp, 0x06, 0x01ef);
17239 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17240 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17241 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
17242 rtl8168_mdio_write(tp, 0x06, 0xef69);
17243 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17244 rtl8168_mdio_write(tp, 0x06, 0x80ad);
17245 rtl8168_mdio_write(tp, 0x06, 0x2722);
17246 rtl8168_mdio_write(tp, 0x06, 0xbf44);
17247 rtl8168_mdio_write(tp, 0x06, 0xfc02);
17248 rtl8168_mdio_write(tp, 0x06, 0x36f6);
17249 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17250 rtl8168_mdio_write(tp, 0x06, 0x441f);
17251 rtl8168_mdio_write(tp, 0x06, 0x019e);
17252 rtl8168_mdio_write(tp, 0x06, 0x15e5);
17253 rtl8168_mdio_write(tp, 0x06, 0x8b44);
17254 rtl8168_mdio_write(tp, 0x06, 0xad29);
17255 rtl8168_mdio_write(tp, 0x06, 0x07ac);
17256 rtl8168_mdio_write(tp, 0x06, 0x2804);
17257 rtl8168_mdio_write(tp, 0x06, 0xd101);
17258 rtl8168_mdio_write(tp, 0x06, 0xae02);
17259 rtl8168_mdio_write(tp, 0x06, 0xd100);
17260 rtl8168_mdio_write(tp, 0x06, 0xbf85);
17261 rtl8168_mdio_write(tp, 0x06, 0xb002);
17262 rtl8168_mdio_write(tp, 0x06, 0x3723);
17263 rtl8168_mdio_write(tp, 0x06, 0xef96);
17264 rtl8168_mdio_write(tp, 0x06, 0xfefc);
17265 rtl8168_mdio_write(tp, 0x06, 0x0400);
17266 rtl8168_mdio_write(tp, 0x06, 0xe140);
17267 rtl8168_mdio_write(tp, 0x06, 0x77e1);
17268 rtl8168_mdio_write(tp, 0x06, 0x40dd);
17269 rtl8168_mdio_write(tp, 0x06, 0xe022);
17270 rtl8168_mdio_write(tp, 0x06, 0x32e1);
17271 rtl8168_mdio_write(tp, 0x06, 0x5074);
17272 rtl8168_mdio_write(tp, 0x06, 0xe144);
17273 rtl8168_mdio_write(tp, 0x06, 0xffe0);
17274 rtl8168_mdio_write(tp, 0x06, 0xdaff);
17275 rtl8168_mdio_write(tp, 0x06, 0xe0c0);
17276 rtl8168_mdio_write(tp, 0x06, 0x52e0);
17277 rtl8168_mdio_write(tp, 0x06, 0xeed9);
17278 rtl8168_mdio_write(tp, 0x06, 0xe04c);
17279 rtl8168_mdio_write(tp, 0x06, 0xbbe0);
17280 rtl8168_mdio_write(tp, 0x06, 0x2a00);
17281 rtl8168_mdio_write(tp, 0x05, 0xe142);
17282 gphy_val = rtl8168_mdio_read(tp, 0x06);
17283 gphy_val |= BIT_0;
17284 rtl8168_mdio_write(tp, 0x06, gphy_val);
17285 rtl8168_mdio_write(tp, 0x05, 0xe140);
17286 gphy_val = rtl8168_mdio_read(tp, 0x06);
17287 gphy_val |= BIT_0;
17288 rtl8168_mdio_write(tp, 0x06, gphy_val);
17289 rtl8168_mdio_write(tp, 0x1f, 0x0000);
17290 rtl8168_mdio_write(tp, 0x1f, 0x0005);
17291 for (i = 0; i < 200; i++) {
17292 udelay(100);
17293 gphy_val = rtl8168_mdio_read(tp, 0x00);
17294 if (gphy_val & BIT_7)
17295 break;
17296 }
17297 rtl8168_mdio_write(tp, 0x1f, 0x0007);
17298 rtl8168_mdio_write(tp, 0x1e, 0x0042);
17299 rtl8168_mdio_write(tp, 0x18, 0x2300);
17300 rtl8168_mdio_write(tp, 0x1f, 0x0000);
17301 rtl8168_mdio_write(tp, 0x1f, 0x0007);
17302 rtl8168_mdio_write(tp, 0x1e, 0x0023);
17303 if (tp->RequiredSecLanDonglePatch) {
17304 gphy_val = rtl8168_mdio_read(tp, 0x17);
17305 gphy_val &= ~BIT_2;
17306 rtl8168_mdio_write(tp, 0x17, gphy_val);
17307 }
17308
17309 rtl8168_mdio_write(tp, 0x1f, 0x0000);
17310 rtl8168_mdio_write(tp, 0x00, 0x9200);
17311 }
17312
17313 static void
rtl8168_set_phy_mcu_8168f_1(struct net_device * dev)17314 rtl8168_set_phy_mcu_8168f_1(struct net_device *dev)
17315 {
17316 struct rtl8168_private *tp = netdev_priv(dev);
17317 unsigned int gphy_val,i;
17318
17319 rtl8168_mdio_write(tp,0x1f, 0x0000);
17320 rtl8168_mdio_write(tp,0x00, 0x1800);
17321 gphy_val = rtl8168_mdio_read(tp, 0x15);
17322 gphy_val &= ~(BIT_12);
17323 rtl8168_mdio_write(tp,0x15, gphy_val);
17324 rtl8168_mdio_write(tp,0x00, 0x4800);
17325 rtl8168_mdio_write(tp,0x1f, 0x0007);
17326 rtl8168_mdio_write(tp,0x1e, 0x002f);
17327 for (i = 0; i < 1000; i++) {
17328 udelay(100);
17329 gphy_val = rtl8168_mdio_read(tp, 0x1c);
17330 if (gphy_val & 0x0080)
17331 break;
17332 }
17333 rtl8168_mdio_write(tp,0x1f, 0x0000);
17334 rtl8168_mdio_write(tp,0x00, 0x1800);
17335 rtl8168_mdio_write(tp,0x1f, 0x0007);
17336 rtl8168_mdio_write(tp,0x1e, 0x0023);
17337 for (i = 0; i < 200; i++) {
17338 udelay(100);
17339 gphy_val = rtl8168_mdio_read(tp, 0x18);
17340 if (!(gphy_val & 0x0001))
17341 break;
17342 }
17343 rtl8168_mdio_write(tp, 0x1f, 0x0005);
17344 rtl8168_mdio_write(tp, 0x05, 0xfff6);
17345 rtl8168_mdio_write(tp, 0x06, 0x0080);
17346 rtl8168_mdio_write(tp, 0x1f, 0x0007);
17347 rtl8168_mdio_write(tp, 0x1e, 0x0023);
17348 rtl8168_mdio_write(tp, 0x16, 0x0306);
17349 rtl8168_mdio_write(tp, 0x16, 0x0307);
17350 rtl8168_mdio_write(tp, 0x15, 0x0194);
17351 rtl8168_mdio_write(tp, 0x19, 0x407D);
17352 rtl8168_mdio_write(tp, 0x15, 0x0098);
17353 rtl8168_mdio_write(tp, 0x19, 0x7c0b);
17354 rtl8168_mdio_write(tp, 0x15, 0x0099);
17355 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
17356 rtl8168_mdio_write(tp, 0x15, 0x00eb);
17357 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
17358 rtl8168_mdio_write(tp, 0x15, 0x00f8);
17359 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
17360 rtl8168_mdio_write(tp, 0x15, 0x00fe);
17361 rtl8168_mdio_write(tp, 0x19, 0x6f0f);
17362 rtl8168_mdio_write(tp, 0x15, 0x00db);
17363 rtl8168_mdio_write(tp, 0x19, 0x6f09);
17364 rtl8168_mdio_write(tp, 0x15, 0x00dc);
17365 rtl8168_mdio_write(tp, 0x19, 0xaefd);
17366 rtl8168_mdio_write(tp, 0x15, 0x00dd);
17367 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
17368 rtl8168_mdio_write(tp, 0x15, 0x00de);
17369 rtl8168_mdio_write(tp, 0x19, 0xc60b);
17370 rtl8168_mdio_write(tp, 0x15, 0x00df);
17371 rtl8168_mdio_write(tp, 0x19, 0x00fa);
17372 rtl8168_mdio_write(tp, 0x15, 0x00e0);
17373 rtl8168_mdio_write(tp, 0x19, 0x30e1);
17374 rtl8168_mdio_write(tp, 0x15, 0x020c);
17375 rtl8168_mdio_write(tp, 0x19, 0x3224);
17376 rtl8168_mdio_write(tp, 0x15, 0x020e);
17377 rtl8168_mdio_write(tp, 0x19, 0x9813);
17378 rtl8168_mdio_write(tp, 0x15, 0x020f);
17379 rtl8168_mdio_write(tp, 0x19, 0x7801);
17380 rtl8168_mdio_write(tp, 0x15, 0x0210);
17381 rtl8168_mdio_write(tp, 0x19, 0x930f);
17382 rtl8168_mdio_write(tp, 0x15, 0x0211);
17383 rtl8168_mdio_write(tp, 0x19, 0x9206);
17384 rtl8168_mdio_write(tp, 0x15, 0x0212);
17385 rtl8168_mdio_write(tp, 0x19, 0x4002);
17386 rtl8168_mdio_write(tp, 0x15, 0x0213);
17387 rtl8168_mdio_write(tp, 0x19, 0x7800);
17388 rtl8168_mdio_write(tp, 0x15, 0x0214);
17389 rtl8168_mdio_write(tp, 0x19, 0x588f);
17390 rtl8168_mdio_write(tp, 0x15, 0x0215);
17391 rtl8168_mdio_write(tp, 0x19, 0x5520);
17392 rtl8168_mdio_write(tp, 0x15, 0x0216);
17393 rtl8168_mdio_write(tp, 0x19, 0x3224);
17394 rtl8168_mdio_write(tp, 0x15, 0x0217);
17395 rtl8168_mdio_write(tp, 0x19, 0x4002);
17396 rtl8168_mdio_write(tp, 0x15, 0x0218);
17397 rtl8168_mdio_write(tp, 0x19, 0x7800);
17398 rtl8168_mdio_write(tp, 0x15, 0x0219);
17399 rtl8168_mdio_write(tp, 0x19, 0x588d);
17400 rtl8168_mdio_write(tp, 0x15, 0x021a);
17401 rtl8168_mdio_write(tp, 0x19, 0x5540);
17402 rtl8168_mdio_write(tp, 0x15, 0x021b);
17403 rtl8168_mdio_write(tp, 0x19, 0x9e03);
17404 rtl8168_mdio_write(tp, 0x15, 0x021c);
17405 rtl8168_mdio_write(tp, 0x19, 0x7c40);
17406 rtl8168_mdio_write(tp, 0x15, 0x021d);
17407 rtl8168_mdio_write(tp, 0x19, 0x6840);
17408 rtl8168_mdio_write(tp, 0x15, 0x021e);
17409 rtl8168_mdio_write(tp, 0x19, 0x3224);
17410 rtl8168_mdio_write(tp, 0x15, 0x021f);
17411 rtl8168_mdio_write(tp, 0x19, 0x4002);
17412 rtl8168_mdio_write(tp, 0x15, 0x0220);
17413 rtl8168_mdio_write(tp, 0x19, 0x3224);
17414 rtl8168_mdio_write(tp, 0x15, 0x0221);
17415 rtl8168_mdio_write(tp, 0x19, 0x9e03);
17416 rtl8168_mdio_write(tp, 0x15, 0x0222);
17417 rtl8168_mdio_write(tp, 0x19, 0x7c40);
17418 rtl8168_mdio_write(tp, 0x15, 0x0223);
17419 rtl8168_mdio_write(tp, 0x19, 0x6840);
17420 rtl8168_mdio_write(tp, 0x15, 0x0224);
17421 rtl8168_mdio_write(tp, 0x19, 0x7800);
17422 rtl8168_mdio_write(tp, 0x15, 0x0225);
17423 rtl8168_mdio_write(tp, 0x19, 0x3231);
17424 rtl8168_mdio_write(tp, 0x15, 0x0000);
17425 rtl8168_mdio_write(tp, 0x16, 0x0306);
17426 rtl8168_mdio_write(tp, 0x16, 0x0300);
17427 rtl8168_mdio_write(tp, 0x1f, 0x0000);
17428 rtl8168_mdio_write(tp, 0x1f, 0x0005);
17429 rtl8168_mdio_write(tp, 0x05, 0xfff6);
17430 rtl8168_mdio_write(tp, 0x06, 0x0080);
17431 rtl8168_mdio_write(tp, 0x05, 0x8000);
17432 rtl8168_mdio_write(tp, 0x06, 0x0280);
17433 rtl8168_mdio_write(tp, 0x06, 0x48f7);
17434 rtl8168_mdio_write(tp, 0x06, 0x00e0);
17435 rtl8168_mdio_write(tp, 0x06, 0xfff7);
17436 rtl8168_mdio_write(tp, 0x06, 0xa080);
17437 rtl8168_mdio_write(tp, 0x06, 0x02ae);
17438 rtl8168_mdio_write(tp, 0x06, 0xf602);
17439 rtl8168_mdio_write(tp, 0x06, 0x0118);
17440 rtl8168_mdio_write(tp, 0x06, 0x0201);
17441 rtl8168_mdio_write(tp, 0x06, 0x2502);
17442 rtl8168_mdio_write(tp, 0x06, 0x8090);
17443 rtl8168_mdio_write(tp, 0x06, 0x0201);
17444 rtl8168_mdio_write(tp, 0x06, 0x4202);
17445 rtl8168_mdio_write(tp, 0x06, 0x015c);
17446 rtl8168_mdio_write(tp, 0x06, 0x0280);
17447 rtl8168_mdio_write(tp, 0x06, 0xad02);
17448 rtl8168_mdio_write(tp, 0x06, 0x80ca);
17449 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17450 rtl8168_mdio_write(tp, 0x06, 0x88e1);
17451 rtl8168_mdio_write(tp, 0x06, 0x8b89);
17452 rtl8168_mdio_write(tp, 0x06, 0x1e01);
17453 rtl8168_mdio_write(tp, 0x06, 0xe18b);
17454 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
17455 rtl8168_mdio_write(tp, 0x06, 0x01e1);
17456 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
17457 rtl8168_mdio_write(tp, 0x06, 0x1e01);
17458 rtl8168_mdio_write(tp, 0x06, 0xe18b);
17459 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
17460 rtl8168_mdio_write(tp, 0x06, 0x01e1);
17461 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
17462 rtl8168_mdio_write(tp, 0x06, 0x1e01);
17463 rtl8168_mdio_write(tp, 0x06, 0xe18b);
17464 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
17465 rtl8168_mdio_write(tp, 0x06, 0x01a0);
17466 rtl8168_mdio_write(tp, 0x06, 0x00c7);
17467 rtl8168_mdio_write(tp, 0x06, 0xaebb);
17468 rtl8168_mdio_write(tp, 0x06, 0xd484);
17469 rtl8168_mdio_write(tp, 0x06, 0x3ce4);
17470 rtl8168_mdio_write(tp, 0x06, 0x8b92);
17471 rtl8168_mdio_write(tp, 0x06, 0xe58b);
17472 rtl8168_mdio_write(tp, 0x06, 0x93ee);
17473 rtl8168_mdio_write(tp, 0x06, 0x8ac8);
17474 rtl8168_mdio_write(tp, 0x06, 0x03ee);
17475 rtl8168_mdio_write(tp, 0x06, 0x8aca);
17476 rtl8168_mdio_write(tp, 0x06, 0x60ee);
17477 rtl8168_mdio_write(tp, 0x06, 0x8ac0);
17478 rtl8168_mdio_write(tp, 0x06, 0x00ee);
17479 rtl8168_mdio_write(tp, 0x06, 0x8ac1);
17480 rtl8168_mdio_write(tp, 0x06, 0x00ee);
17481 rtl8168_mdio_write(tp, 0x06, 0x8abe);
17482 rtl8168_mdio_write(tp, 0x06, 0x07ee);
17483 rtl8168_mdio_write(tp, 0x06, 0x8abf);
17484 rtl8168_mdio_write(tp, 0x06, 0x73ee);
17485 rtl8168_mdio_write(tp, 0x06, 0x8a95);
17486 rtl8168_mdio_write(tp, 0x06, 0x02bf);
17487 rtl8168_mdio_write(tp, 0x06, 0x8b88);
17488 rtl8168_mdio_write(tp, 0x06, 0xec00);
17489 rtl8168_mdio_write(tp, 0x06, 0x19a9);
17490 rtl8168_mdio_write(tp, 0x06, 0x8b90);
17491 rtl8168_mdio_write(tp, 0x06, 0xf9ee);
17492 rtl8168_mdio_write(tp, 0x06, 0xfff6);
17493 rtl8168_mdio_write(tp, 0x06, 0x00ee);
17494 rtl8168_mdio_write(tp, 0x06, 0xfff7);
17495 rtl8168_mdio_write(tp, 0x06, 0xfed1);
17496 rtl8168_mdio_write(tp, 0x06, 0x00bf);
17497 rtl8168_mdio_write(tp, 0x06, 0x85a4);
17498 rtl8168_mdio_write(tp, 0x06, 0x0238);
17499 rtl8168_mdio_write(tp, 0x06, 0x7dd1);
17500 rtl8168_mdio_write(tp, 0x06, 0x01bf);
17501 rtl8168_mdio_write(tp, 0x06, 0x85a7);
17502 rtl8168_mdio_write(tp, 0x06, 0x0238);
17503 rtl8168_mdio_write(tp, 0x06, 0x7d04);
17504 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
17505 rtl8168_mdio_write(tp, 0x06, 0x8b8a);
17506 rtl8168_mdio_write(tp, 0x06, 0xad20);
17507 rtl8168_mdio_write(tp, 0x06, 0x14ee);
17508 rtl8168_mdio_write(tp, 0x06, 0x8b8a);
17509 rtl8168_mdio_write(tp, 0x06, 0x0002);
17510 rtl8168_mdio_write(tp, 0x06, 0x204b);
17511 rtl8168_mdio_write(tp, 0x06, 0xe0e4);
17512 rtl8168_mdio_write(tp, 0x06, 0x26e1);
17513 rtl8168_mdio_write(tp, 0x06, 0xe427);
17514 rtl8168_mdio_write(tp, 0x06, 0xeee4);
17515 rtl8168_mdio_write(tp, 0x06, 0x2623);
17516 rtl8168_mdio_write(tp, 0x06, 0xe5e4);
17517 rtl8168_mdio_write(tp, 0x06, 0x27fc);
17518 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17519 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17520 rtl8168_mdio_write(tp, 0x06, 0x8dad);
17521 rtl8168_mdio_write(tp, 0x06, 0x2014);
17522 rtl8168_mdio_write(tp, 0x06, 0xee8b);
17523 rtl8168_mdio_write(tp, 0x06, 0x8d00);
17524 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17525 rtl8168_mdio_write(tp, 0x06, 0x5a78);
17526 rtl8168_mdio_write(tp, 0x06, 0x039e);
17527 rtl8168_mdio_write(tp, 0x06, 0x0902);
17528 rtl8168_mdio_write(tp, 0x06, 0x05e8);
17529 rtl8168_mdio_write(tp, 0x06, 0x0281);
17530 rtl8168_mdio_write(tp, 0x06, 0x4f02);
17531 rtl8168_mdio_write(tp, 0x06, 0x326c);
17532 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17533 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
17534 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17535 rtl8168_mdio_write(tp, 0x06, 0xad20);
17536 rtl8168_mdio_write(tp, 0x06, 0x1df6);
17537 rtl8168_mdio_write(tp, 0x06, 0x20e4);
17538 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17539 rtl8168_mdio_write(tp, 0x06, 0x022f);
17540 rtl8168_mdio_write(tp, 0x06, 0x0902);
17541 rtl8168_mdio_write(tp, 0x06, 0x2ab0);
17542 rtl8168_mdio_write(tp, 0x06, 0x0285);
17543 rtl8168_mdio_write(tp, 0x06, 0x1602);
17544 rtl8168_mdio_write(tp, 0x06, 0x03ba);
17545 rtl8168_mdio_write(tp, 0x06, 0x0284);
17546 rtl8168_mdio_write(tp, 0x06, 0xe502);
17547 rtl8168_mdio_write(tp, 0x06, 0x2df1);
17548 rtl8168_mdio_write(tp, 0x06, 0x0283);
17549 rtl8168_mdio_write(tp, 0x06, 0x8302);
17550 rtl8168_mdio_write(tp, 0x06, 0x0475);
17551 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17552 rtl8168_mdio_write(tp, 0x06, 0x8ead);
17553 rtl8168_mdio_write(tp, 0x06, 0x210b);
17554 rtl8168_mdio_write(tp, 0x06, 0xf621);
17555 rtl8168_mdio_write(tp, 0x06, 0xe48b);
17556 rtl8168_mdio_write(tp, 0x06, 0x8e02);
17557 rtl8168_mdio_write(tp, 0x06, 0x83f8);
17558 rtl8168_mdio_write(tp, 0x06, 0x021c);
17559 rtl8168_mdio_write(tp, 0x06, 0x99e0);
17560 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17561 rtl8168_mdio_write(tp, 0x06, 0xad22);
17562 rtl8168_mdio_write(tp, 0x06, 0x08f6);
17563 rtl8168_mdio_write(tp, 0x06, 0x22e4);
17564 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17565 rtl8168_mdio_write(tp, 0x06, 0x0235);
17566 rtl8168_mdio_write(tp, 0x06, 0x63e0);
17567 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17568 rtl8168_mdio_write(tp, 0x06, 0xad23);
17569 rtl8168_mdio_write(tp, 0x06, 0x08f6);
17570 rtl8168_mdio_write(tp, 0x06, 0x23e4);
17571 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17572 rtl8168_mdio_write(tp, 0x06, 0x0231);
17573 rtl8168_mdio_write(tp, 0x06, 0x57e0);
17574 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17575 rtl8168_mdio_write(tp, 0x06, 0xad24);
17576 rtl8168_mdio_write(tp, 0x06, 0x05f6);
17577 rtl8168_mdio_write(tp, 0x06, 0x24e4);
17578 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17579 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17580 rtl8168_mdio_write(tp, 0x06, 0x8ead);
17581 rtl8168_mdio_write(tp, 0x06, 0x2505);
17582 rtl8168_mdio_write(tp, 0x06, 0xf625);
17583 rtl8168_mdio_write(tp, 0x06, 0xe48b);
17584 rtl8168_mdio_write(tp, 0x06, 0x8ee0);
17585 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17586 rtl8168_mdio_write(tp, 0x06, 0xad26);
17587 rtl8168_mdio_write(tp, 0x06, 0x08f6);
17588 rtl8168_mdio_write(tp, 0x06, 0x26e4);
17589 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17590 rtl8168_mdio_write(tp, 0x06, 0x022d);
17591 rtl8168_mdio_write(tp, 0x06, 0x1ce0);
17592 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17593 rtl8168_mdio_write(tp, 0x06, 0xad27);
17594 rtl8168_mdio_write(tp, 0x06, 0x05f6);
17595 rtl8168_mdio_write(tp, 0x06, 0x27e4);
17596 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
17597 rtl8168_mdio_write(tp, 0x06, 0x0203);
17598 rtl8168_mdio_write(tp, 0x06, 0x80fc);
17599 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17600 rtl8168_mdio_write(tp, 0x06, 0xf9e0);
17601 rtl8168_mdio_write(tp, 0x06, 0x8b81);
17602 rtl8168_mdio_write(tp, 0x06, 0xac26);
17603 rtl8168_mdio_write(tp, 0x06, 0x1ae0);
17604 rtl8168_mdio_write(tp, 0x06, 0x8b81);
17605 rtl8168_mdio_write(tp, 0x06, 0xac21);
17606 rtl8168_mdio_write(tp, 0x06, 0x14e0);
17607 rtl8168_mdio_write(tp, 0x06, 0x8b85);
17608 rtl8168_mdio_write(tp, 0x06, 0xac20);
17609 rtl8168_mdio_write(tp, 0x06, 0x0ee0);
17610 rtl8168_mdio_write(tp, 0x06, 0x8b85);
17611 rtl8168_mdio_write(tp, 0x06, 0xac23);
17612 rtl8168_mdio_write(tp, 0x06, 0x08e0);
17613 rtl8168_mdio_write(tp, 0x06, 0x8b87);
17614 rtl8168_mdio_write(tp, 0x06, 0xac24);
17615 rtl8168_mdio_write(tp, 0x06, 0x02ae);
17616 rtl8168_mdio_write(tp, 0x06, 0x3802);
17617 rtl8168_mdio_write(tp, 0x06, 0x1ac2);
17618 rtl8168_mdio_write(tp, 0x06, 0xeee4);
17619 rtl8168_mdio_write(tp, 0x06, 0x1c04);
17620 rtl8168_mdio_write(tp, 0x06, 0xeee4);
17621 rtl8168_mdio_write(tp, 0x06, 0x1d04);
17622 rtl8168_mdio_write(tp, 0x06, 0xe2e0);
17623 rtl8168_mdio_write(tp, 0x06, 0x7ce3);
17624 rtl8168_mdio_write(tp, 0x06, 0xe07d);
17625 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
17626 rtl8168_mdio_write(tp, 0x06, 0x38e1);
17627 rtl8168_mdio_write(tp, 0x06, 0xe039);
17628 rtl8168_mdio_write(tp, 0x06, 0xad2e);
17629 rtl8168_mdio_write(tp, 0x06, 0x1bad);
17630 rtl8168_mdio_write(tp, 0x06, 0x390d);
17631 rtl8168_mdio_write(tp, 0x06, 0xd101);
17632 rtl8168_mdio_write(tp, 0x06, 0xbf22);
17633 rtl8168_mdio_write(tp, 0x06, 0x7a02);
17634 rtl8168_mdio_write(tp, 0x06, 0x387d);
17635 rtl8168_mdio_write(tp, 0x06, 0x0281);
17636 rtl8168_mdio_write(tp, 0x06, 0xacae);
17637 rtl8168_mdio_write(tp, 0x06, 0x0bac);
17638 rtl8168_mdio_write(tp, 0x06, 0x3802);
17639 rtl8168_mdio_write(tp, 0x06, 0xae06);
17640 rtl8168_mdio_write(tp, 0x06, 0x0281);
17641 rtl8168_mdio_write(tp, 0x06, 0xe902);
17642 rtl8168_mdio_write(tp, 0x06, 0x822e);
17643 rtl8168_mdio_write(tp, 0x06, 0x021a);
17644 rtl8168_mdio_write(tp, 0x06, 0xd3fd);
17645 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17646 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
17647 rtl8168_mdio_write(tp, 0x06, 0x8af4);
17648 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17649 rtl8168_mdio_write(tp, 0x06, 0x81ad);
17650 rtl8168_mdio_write(tp, 0x06, 0x2602);
17651 rtl8168_mdio_write(tp, 0x06, 0xf728);
17652 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17653 rtl8168_mdio_write(tp, 0x06, 0x81ad);
17654 rtl8168_mdio_write(tp, 0x06, 0x2105);
17655 rtl8168_mdio_write(tp, 0x06, 0x0222);
17656 rtl8168_mdio_write(tp, 0x06, 0x8ef7);
17657 rtl8168_mdio_write(tp, 0x06, 0x29e0);
17658 rtl8168_mdio_write(tp, 0x06, 0x8b85);
17659 rtl8168_mdio_write(tp, 0x06, 0xad20);
17660 rtl8168_mdio_write(tp, 0x06, 0x0502);
17661 rtl8168_mdio_write(tp, 0x06, 0x14b8);
17662 rtl8168_mdio_write(tp, 0x06, 0xf72a);
17663 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17664 rtl8168_mdio_write(tp, 0x06, 0x85ad);
17665 rtl8168_mdio_write(tp, 0x06, 0x2305);
17666 rtl8168_mdio_write(tp, 0x06, 0x0212);
17667 rtl8168_mdio_write(tp, 0x06, 0xf4f7);
17668 rtl8168_mdio_write(tp, 0x06, 0x2be0);
17669 rtl8168_mdio_write(tp, 0x06, 0x8b87);
17670 rtl8168_mdio_write(tp, 0x06, 0xad24);
17671 rtl8168_mdio_write(tp, 0x06, 0x0502);
17672 rtl8168_mdio_write(tp, 0x06, 0x8284);
17673 rtl8168_mdio_write(tp, 0x06, 0xf72c);
17674 rtl8168_mdio_write(tp, 0x06, 0xe58a);
17675 rtl8168_mdio_write(tp, 0x06, 0xf4fc);
17676 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17677 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17678 rtl8168_mdio_write(tp, 0x06, 0x81ad);
17679 rtl8168_mdio_write(tp, 0x06, 0x2600);
17680 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17681 rtl8168_mdio_write(tp, 0x06, 0x81ad);
17682 rtl8168_mdio_write(tp, 0x06, 0x2109);
17683 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17684 rtl8168_mdio_write(tp, 0x06, 0xf4ac);
17685 rtl8168_mdio_write(tp, 0x06, 0x2003);
17686 rtl8168_mdio_write(tp, 0x06, 0x0222);
17687 rtl8168_mdio_write(tp, 0x06, 0x7de0);
17688 rtl8168_mdio_write(tp, 0x06, 0x8b85);
17689 rtl8168_mdio_write(tp, 0x06, 0xad20);
17690 rtl8168_mdio_write(tp, 0x06, 0x09e0);
17691 rtl8168_mdio_write(tp, 0x06, 0x8af4);
17692 rtl8168_mdio_write(tp, 0x06, 0xac21);
17693 rtl8168_mdio_write(tp, 0x06, 0x0302);
17694 rtl8168_mdio_write(tp, 0x06, 0x1408);
17695 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17696 rtl8168_mdio_write(tp, 0x06, 0x85ad);
17697 rtl8168_mdio_write(tp, 0x06, 0x2309);
17698 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17699 rtl8168_mdio_write(tp, 0x06, 0xf4ac);
17700 rtl8168_mdio_write(tp, 0x06, 0x2203);
17701 rtl8168_mdio_write(tp, 0x06, 0x0213);
17702 rtl8168_mdio_write(tp, 0x06, 0x07e0);
17703 rtl8168_mdio_write(tp, 0x06, 0x8b87);
17704 rtl8168_mdio_write(tp, 0x06, 0xad24);
17705 rtl8168_mdio_write(tp, 0x06, 0x09e0);
17706 rtl8168_mdio_write(tp, 0x06, 0x8af4);
17707 rtl8168_mdio_write(tp, 0x06, 0xac23);
17708 rtl8168_mdio_write(tp, 0x06, 0x0302);
17709 rtl8168_mdio_write(tp, 0x06, 0x8289);
17710 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17711 rtl8168_mdio_write(tp, 0x06, 0xf8e1);
17712 rtl8168_mdio_write(tp, 0x06, 0x8af4);
17713 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17714 rtl8168_mdio_write(tp, 0x06, 0x81ad);
17715 rtl8168_mdio_write(tp, 0x06, 0x2602);
17716 rtl8168_mdio_write(tp, 0x06, 0xf628);
17717 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17718 rtl8168_mdio_write(tp, 0x06, 0x81ad);
17719 rtl8168_mdio_write(tp, 0x06, 0x210a);
17720 rtl8168_mdio_write(tp, 0x06, 0xe083);
17721 rtl8168_mdio_write(tp, 0x06, 0xecf6);
17722 rtl8168_mdio_write(tp, 0x06, 0x27a0);
17723 rtl8168_mdio_write(tp, 0x06, 0x0502);
17724 rtl8168_mdio_write(tp, 0x06, 0xf629);
17725 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17726 rtl8168_mdio_write(tp, 0x06, 0x85ad);
17727 rtl8168_mdio_write(tp, 0x06, 0x2008);
17728 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17729 rtl8168_mdio_write(tp, 0x06, 0xe8ad);
17730 rtl8168_mdio_write(tp, 0x06, 0x2102);
17731 rtl8168_mdio_write(tp, 0x06, 0xf62a);
17732 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17733 rtl8168_mdio_write(tp, 0x06, 0x85ad);
17734 rtl8168_mdio_write(tp, 0x06, 0x2308);
17735 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17736 rtl8168_mdio_write(tp, 0x06, 0x20a0);
17737 rtl8168_mdio_write(tp, 0x06, 0x0302);
17738 rtl8168_mdio_write(tp, 0x06, 0xf62b);
17739 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17740 rtl8168_mdio_write(tp, 0x06, 0x87ad);
17741 rtl8168_mdio_write(tp, 0x06, 0x2408);
17742 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17743 rtl8168_mdio_write(tp, 0x06, 0xc2a0);
17744 rtl8168_mdio_write(tp, 0x06, 0x0302);
17745 rtl8168_mdio_write(tp, 0x06, 0xf62c);
17746 rtl8168_mdio_write(tp, 0x06, 0xe58a);
17747 rtl8168_mdio_write(tp, 0x06, 0xf4a1);
17748 rtl8168_mdio_write(tp, 0x06, 0x0008);
17749 rtl8168_mdio_write(tp, 0x06, 0xd100);
17750 rtl8168_mdio_write(tp, 0x06, 0xbf22);
17751 rtl8168_mdio_write(tp, 0x06, 0x7a02);
17752 rtl8168_mdio_write(tp, 0x06, 0x387d);
17753 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17754 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17755 rtl8168_mdio_write(tp, 0x06, 0xc200);
17756 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17757 rtl8168_mdio_write(tp, 0x06, 0xe08b);
17758 rtl8168_mdio_write(tp, 0x06, 0x87ad);
17759 rtl8168_mdio_write(tp, 0x06, 0x241e);
17760 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17761 rtl8168_mdio_write(tp, 0x06, 0xc2a0);
17762 rtl8168_mdio_write(tp, 0x06, 0x0005);
17763 rtl8168_mdio_write(tp, 0x06, 0x0282);
17764 rtl8168_mdio_write(tp, 0x06, 0xb0ae);
17765 rtl8168_mdio_write(tp, 0x06, 0xf5a0);
17766 rtl8168_mdio_write(tp, 0x06, 0x0105);
17767 rtl8168_mdio_write(tp, 0x06, 0x0282);
17768 rtl8168_mdio_write(tp, 0x06, 0xc0ae);
17769 rtl8168_mdio_write(tp, 0x06, 0x0ba0);
17770 rtl8168_mdio_write(tp, 0x06, 0x0205);
17771 rtl8168_mdio_write(tp, 0x06, 0x0282);
17772 rtl8168_mdio_write(tp, 0x06, 0xcaae);
17773 rtl8168_mdio_write(tp, 0x06, 0x03a0);
17774 rtl8168_mdio_write(tp, 0x06, 0x0300);
17775 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17776 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
17777 rtl8168_mdio_write(tp, 0x06, 0xef69);
17778 rtl8168_mdio_write(tp, 0x06, 0x0282);
17779 rtl8168_mdio_write(tp, 0x06, 0xe1ee);
17780 rtl8168_mdio_write(tp, 0x06, 0x8ac2);
17781 rtl8168_mdio_write(tp, 0x06, 0x01ef);
17782 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17783 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17784 rtl8168_mdio_write(tp, 0x06, 0xf8ee);
17785 rtl8168_mdio_write(tp, 0x06, 0x8ac9);
17786 rtl8168_mdio_write(tp, 0x06, 0x0002);
17787 rtl8168_mdio_write(tp, 0x06, 0x8317);
17788 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17789 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
17790 rtl8168_mdio_write(tp, 0x06, 0x8ac8);
17791 rtl8168_mdio_write(tp, 0x06, 0xe18a);
17792 rtl8168_mdio_write(tp, 0x06, 0xc91f);
17793 rtl8168_mdio_write(tp, 0x06, 0x019e);
17794 rtl8168_mdio_write(tp, 0x06, 0x0611);
17795 rtl8168_mdio_write(tp, 0x06, 0xe58a);
17796 rtl8168_mdio_write(tp, 0x06, 0xc9ae);
17797 rtl8168_mdio_write(tp, 0x06, 0x04ee);
17798 rtl8168_mdio_write(tp, 0x06, 0x8ac2);
17799 rtl8168_mdio_write(tp, 0x06, 0x01fc);
17800 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17801 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
17802 rtl8168_mdio_write(tp, 0x06, 0xef69);
17803 rtl8168_mdio_write(tp, 0x06, 0xfbbf);
17804 rtl8168_mdio_write(tp, 0x06, 0x8ac4);
17805 rtl8168_mdio_write(tp, 0x06, 0xef79);
17806 rtl8168_mdio_write(tp, 0x06, 0xd200);
17807 rtl8168_mdio_write(tp, 0x06, 0xd400);
17808 rtl8168_mdio_write(tp, 0x06, 0x221e);
17809 rtl8168_mdio_write(tp, 0x06, 0x02bf);
17810 rtl8168_mdio_write(tp, 0x06, 0x3024);
17811 rtl8168_mdio_write(tp, 0x06, 0x0238);
17812 rtl8168_mdio_write(tp, 0x06, 0x7dbf);
17813 rtl8168_mdio_write(tp, 0x06, 0x13ff);
17814 rtl8168_mdio_write(tp, 0x06, 0x0238);
17815 rtl8168_mdio_write(tp, 0x06, 0x500d);
17816 rtl8168_mdio_write(tp, 0x06, 0x4559);
17817 rtl8168_mdio_write(tp, 0x06, 0x1fef);
17818 rtl8168_mdio_write(tp, 0x06, 0x97dd);
17819 rtl8168_mdio_write(tp, 0x06, 0xd308);
17820 rtl8168_mdio_write(tp, 0x06, 0x1a93);
17821 rtl8168_mdio_write(tp, 0x06, 0xdd12);
17822 rtl8168_mdio_write(tp, 0x06, 0x17a2);
17823 rtl8168_mdio_write(tp, 0x06, 0x04de);
17824 rtl8168_mdio_write(tp, 0x06, 0xffef);
17825 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17826 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
17827 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17828 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
17829 rtl8168_mdio_write(tp, 0x06, 0xef69);
17830 rtl8168_mdio_write(tp, 0x06, 0xfbee);
17831 rtl8168_mdio_write(tp, 0x06, 0x8ac2);
17832 rtl8168_mdio_write(tp, 0x06, 0x03d5);
17833 rtl8168_mdio_write(tp, 0x06, 0x0080);
17834 rtl8168_mdio_write(tp, 0x06, 0xbf8a);
17835 rtl8168_mdio_write(tp, 0x06, 0xc4ef);
17836 rtl8168_mdio_write(tp, 0x06, 0x79ef);
17837 rtl8168_mdio_write(tp, 0x06, 0x45bf);
17838 rtl8168_mdio_write(tp, 0x06, 0x3024);
17839 rtl8168_mdio_write(tp, 0x06, 0x0238);
17840 rtl8168_mdio_write(tp, 0x06, 0x7dbf);
17841 rtl8168_mdio_write(tp, 0x06, 0x13ff);
17842 rtl8168_mdio_write(tp, 0x06, 0x0238);
17843 rtl8168_mdio_write(tp, 0x06, 0x50ad);
17844 rtl8168_mdio_write(tp, 0x06, 0x2702);
17845 rtl8168_mdio_write(tp, 0x06, 0x78ff);
17846 rtl8168_mdio_write(tp, 0x06, 0xe18a);
17847 rtl8168_mdio_write(tp, 0x06, 0xca1b);
17848 rtl8168_mdio_write(tp, 0x06, 0x01aa);
17849 rtl8168_mdio_write(tp, 0x06, 0x2eef);
17850 rtl8168_mdio_write(tp, 0x06, 0x97d9);
17851 rtl8168_mdio_write(tp, 0x06, 0x7900);
17852 rtl8168_mdio_write(tp, 0x06, 0x9e2b);
17853 rtl8168_mdio_write(tp, 0x06, 0x81dd);
17854 rtl8168_mdio_write(tp, 0x06, 0xbf85);
17855 rtl8168_mdio_write(tp, 0x06, 0xad02);
17856 rtl8168_mdio_write(tp, 0x06, 0x387d);
17857 rtl8168_mdio_write(tp, 0x06, 0xd101);
17858 rtl8168_mdio_write(tp, 0x06, 0xef02);
17859 rtl8168_mdio_write(tp, 0x06, 0x100c);
17860 rtl8168_mdio_write(tp, 0x06, 0x11b0);
17861 rtl8168_mdio_write(tp, 0x06, 0xfc0d);
17862 rtl8168_mdio_write(tp, 0x06, 0x11bf);
17863 rtl8168_mdio_write(tp, 0x06, 0x85aa);
17864 rtl8168_mdio_write(tp, 0x06, 0x0238);
17865 rtl8168_mdio_write(tp, 0x06, 0x7dd1);
17866 rtl8168_mdio_write(tp, 0x06, 0x00bf);
17867 rtl8168_mdio_write(tp, 0x06, 0x85aa);
17868 rtl8168_mdio_write(tp, 0x06, 0x0238);
17869 rtl8168_mdio_write(tp, 0x06, 0x7dee);
17870 rtl8168_mdio_write(tp, 0x06, 0x8ac2);
17871 rtl8168_mdio_write(tp, 0x06, 0x02ae);
17872 rtl8168_mdio_write(tp, 0x06, 0x0413);
17873 rtl8168_mdio_write(tp, 0x06, 0xa38b);
17874 rtl8168_mdio_write(tp, 0x06, 0xb4d3);
17875 rtl8168_mdio_write(tp, 0x06, 0x8012);
17876 rtl8168_mdio_write(tp, 0x06, 0x17a2);
17877 rtl8168_mdio_write(tp, 0x06, 0x04ad);
17878 rtl8168_mdio_write(tp, 0x06, 0xffef);
17879 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17880 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
17881 rtl8168_mdio_write(tp, 0x06, 0x04f8);
17882 rtl8168_mdio_write(tp, 0x06, 0xf9e0);
17883 rtl8168_mdio_write(tp, 0x06, 0x8b85);
17884 rtl8168_mdio_write(tp, 0x06, 0xad25);
17885 rtl8168_mdio_write(tp, 0x06, 0x48e0);
17886 rtl8168_mdio_write(tp, 0x06, 0x8a96);
17887 rtl8168_mdio_write(tp, 0x06, 0xe18a);
17888 rtl8168_mdio_write(tp, 0x06, 0x977c);
17889 rtl8168_mdio_write(tp, 0x06, 0x0000);
17890 rtl8168_mdio_write(tp, 0x06, 0x9e35);
17891 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17892 rtl8168_mdio_write(tp, 0x06, 0x9600);
17893 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17894 rtl8168_mdio_write(tp, 0x06, 0x9700);
17895 rtl8168_mdio_write(tp, 0x06, 0xe08a);
17896 rtl8168_mdio_write(tp, 0x06, 0xbee1);
17897 rtl8168_mdio_write(tp, 0x06, 0x8abf);
17898 rtl8168_mdio_write(tp, 0x06, 0xe28a);
17899 rtl8168_mdio_write(tp, 0x06, 0xc0e3);
17900 rtl8168_mdio_write(tp, 0x06, 0x8ac1);
17901 rtl8168_mdio_write(tp, 0x06, 0x0237);
17902 rtl8168_mdio_write(tp, 0x06, 0x74ad);
17903 rtl8168_mdio_write(tp, 0x06, 0x2012);
17904 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17905 rtl8168_mdio_write(tp, 0x06, 0x9603);
17906 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17907 rtl8168_mdio_write(tp, 0x06, 0x97b7);
17908 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17909 rtl8168_mdio_write(tp, 0x06, 0xc000);
17910 rtl8168_mdio_write(tp, 0x06, 0xee8a);
17911 rtl8168_mdio_write(tp, 0x06, 0xc100);
17912 rtl8168_mdio_write(tp, 0x06, 0xae11);
17913 rtl8168_mdio_write(tp, 0x06, 0x15e6);
17914 rtl8168_mdio_write(tp, 0x06, 0x8ac0);
17915 rtl8168_mdio_write(tp, 0x06, 0xe78a);
17916 rtl8168_mdio_write(tp, 0x06, 0xc1ae);
17917 rtl8168_mdio_write(tp, 0x06, 0x08ee);
17918 rtl8168_mdio_write(tp, 0x06, 0x8ac0);
17919 rtl8168_mdio_write(tp, 0x06, 0x00ee);
17920 rtl8168_mdio_write(tp, 0x06, 0x8ac1);
17921 rtl8168_mdio_write(tp, 0x06, 0x00fd);
17922 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17923 rtl8168_mdio_write(tp, 0x06, 0xae20);
17924 rtl8168_mdio_write(tp, 0x06, 0x0000);
17925 rtl8168_mdio_write(tp, 0x06, 0x0000);
17926 rtl8168_mdio_write(tp, 0x06, 0x0000);
17927 rtl8168_mdio_write(tp, 0x06, 0x0000);
17928 rtl8168_mdio_write(tp, 0x06, 0x0000);
17929 rtl8168_mdio_write(tp, 0x06, 0x0000);
17930 rtl8168_mdio_write(tp, 0x06, 0x0000);
17931 rtl8168_mdio_write(tp, 0x06, 0x0000);
17932 rtl8168_mdio_write(tp, 0x06, 0x0000);
17933 rtl8168_mdio_write(tp, 0x06, 0x0000);
17934 rtl8168_mdio_write(tp, 0x06, 0x0000);
17935 rtl8168_mdio_write(tp, 0x06, 0x0000);
17936 rtl8168_mdio_write(tp, 0x06, 0x0000);
17937 rtl8168_mdio_write(tp, 0x06, 0x0000);
17938 rtl8168_mdio_write(tp, 0x06, 0x0000);
17939 rtl8168_mdio_write(tp, 0x06, 0x0000);
17940 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
17941 rtl8168_mdio_write(tp, 0x06, 0xef69);
17942 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
17943 rtl8168_mdio_write(tp, 0x06, 0x00e1);
17944 rtl8168_mdio_write(tp, 0x06, 0xe001);
17945 rtl8168_mdio_write(tp, 0x06, 0xad27);
17946 rtl8168_mdio_write(tp, 0x06, 0x32e0);
17947 rtl8168_mdio_write(tp, 0x06, 0x8b40);
17948 rtl8168_mdio_write(tp, 0x06, 0xf720);
17949 rtl8168_mdio_write(tp, 0x06, 0xe48b);
17950 rtl8168_mdio_write(tp, 0x06, 0x40bf);
17951 rtl8168_mdio_write(tp, 0x06, 0x3230);
17952 rtl8168_mdio_write(tp, 0x06, 0x0238);
17953 rtl8168_mdio_write(tp, 0x06, 0x50ad);
17954 rtl8168_mdio_write(tp, 0x06, 0x2821);
17955 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
17956 rtl8168_mdio_write(tp, 0x06, 0x20e1);
17957 rtl8168_mdio_write(tp, 0x06, 0xe021);
17958 rtl8168_mdio_write(tp, 0x06, 0xad20);
17959 rtl8168_mdio_write(tp, 0x06, 0x18e0);
17960 rtl8168_mdio_write(tp, 0x06, 0x8b40);
17961 rtl8168_mdio_write(tp, 0x06, 0xf620);
17962 rtl8168_mdio_write(tp, 0x06, 0xe48b);
17963 rtl8168_mdio_write(tp, 0x06, 0x40ee);
17964 rtl8168_mdio_write(tp, 0x06, 0x8b3b);
17965 rtl8168_mdio_write(tp, 0x06, 0xffe0);
17966 rtl8168_mdio_write(tp, 0x06, 0x8a8a);
17967 rtl8168_mdio_write(tp, 0x06, 0xe18a);
17968 rtl8168_mdio_write(tp, 0x06, 0x8be4);
17969 rtl8168_mdio_write(tp, 0x06, 0xe000);
17970 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
17971 rtl8168_mdio_write(tp, 0x06, 0x01ef);
17972 rtl8168_mdio_write(tp, 0x06, 0x96fe);
17973 rtl8168_mdio_write(tp, 0x06, 0xfc04);
17974 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
17975 rtl8168_mdio_write(tp, 0x06, 0xface);
17976 rtl8168_mdio_write(tp, 0x06, 0xfaef);
17977 rtl8168_mdio_write(tp, 0x06, 0x69fa);
17978 rtl8168_mdio_write(tp, 0x06, 0xd401);
17979 rtl8168_mdio_write(tp, 0x06, 0x55b4);
17980 rtl8168_mdio_write(tp, 0x06, 0xfebf);
17981 rtl8168_mdio_write(tp, 0x06, 0x1c1e);
17982 rtl8168_mdio_write(tp, 0x06, 0x0238);
17983 rtl8168_mdio_write(tp, 0x06, 0x50ac);
17984 rtl8168_mdio_write(tp, 0x06, 0x280b);
17985 rtl8168_mdio_write(tp, 0x06, 0xbf1c);
17986 rtl8168_mdio_write(tp, 0x06, 0x1b02);
17987 rtl8168_mdio_write(tp, 0x06, 0x3850);
17988 rtl8168_mdio_write(tp, 0x06, 0xac28);
17989 rtl8168_mdio_write(tp, 0x06, 0x49ae);
17990 rtl8168_mdio_write(tp, 0x06, 0x64bf);
17991 rtl8168_mdio_write(tp, 0x06, 0x1c1b);
17992 rtl8168_mdio_write(tp, 0x06, 0x0238);
17993 rtl8168_mdio_write(tp, 0x06, 0x50ac);
17994 rtl8168_mdio_write(tp, 0x06, 0x285b);
17995 rtl8168_mdio_write(tp, 0x06, 0xd000);
17996 rtl8168_mdio_write(tp, 0x06, 0x0284);
17997 rtl8168_mdio_write(tp, 0x06, 0xcaac);
17998 rtl8168_mdio_write(tp, 0x06, 0x2105);
17999 rtl8168_mdio_write(tp, 0x06, 0xac22);
18000 rtl8168_mdio_write(tp, 0x06, 0x02ae);
18001 rtl8168_mdio_write(tp, 0x06, 0x4ebf);
18002 rtl8168_mdio_write(tp, 0x06, 0xe0c4);
18003 rtl8168_mdio_write(tp, 0x06, 0xbe85);
18004 rtl8168_mdio_write(tp, 0x06, 0xf6d2);
18005 rtl8168_mdio_write(tp, 0x06, 0x04d8);
18006 rtl8168_mdio_write(tp, 0x06, 0x19d9);
18007 rtl8168_mdio_write(tp, 0x06, 0x1907);
18008 rtl8168_mdio_write(tp, 0x06, 0xdc19);
18009 rtl8168_mdio_write(tp, 0x06, 0xdd19);
18010 rtl8168_mdio_write(tp, 0x06, 0x0789);
18011 rtl8168_mdio_write(tp, 0x06, 0x89ef);
18012 rtl8168_mdio_write(tp, 0x06, 0x645e);
18013 rtl8168_mdio_write(tp, 0x06, 0x07ff);
18014 rtl8168_mdio_write(tp, 0x06, 0x0d65);
18015 rtl8168_mdio_write(tp, 0x06, 0x5cf8);
18016 rtl8168_mdio_write(tp, 0x06, 0x001e);
18017 rtl8168_mdio_write(tp, 0x06, 0x46dc);
18018 rtl8168_mdio_write(tp, 0x06, 0x19dd);
18019 rtl8168_mdio_write(tp, 0x06, 0x19b2);
18020 rtl8168_mdio_write(tp, 0x06, 0xe2d4);
18021 rtl8168_mdio_write(tp, 0x06, 0x0001);
18022 rtl8168_mdio_write(tp, 0x06, 0xbf1c);
18023 rtl8168_mdio_write(tp, 0x06, 0x1b02);
18024 rtl8168_mdio_write(tp, 0x06, 0x387d);
18025 rtl8168_mdio_write(tp, 0x06, 0xae1d);
18026 rtl8168_mdio_write(tp, 0x06, 0xbee0);
18027 rtl8168_mdio_write(tp, 0x06, 0xc4bf);
18028 rtl8168_mdio_write(tp, 0x06, 0x85f6);
18029 rtl8168_mdio_write(tp, 0x06, 0xd204);
18030 rtl8168_mdio_write(tp, 0x06, 0xd819);
18031 rtl8168_mdio_write(tp, 0x06, 0xd919);
18032 rtl8168_mdio_write(tp, 0x06, 0x07dc);
18033 rtl8168_mdio_write(tp, 0x06, 0x19dd);
18034 rtl8168_mdio_write(tp, 0x06, 0x1907);
18035 rtl8168_mdio_write(tp, 0x06, 0xb2f4);
18036 rtl8168_mdio_write(tp, 0x06, 0xd400);
18037 rtl8168_mdio_write(tp, 0x06, 0x00bf);
18038 rtl8168_mdio_write(tp, 0x06, 0x1c1b);
18039 rtl8168_mdio_write(tp, 0x06, 0x0238);
18040 rtl8168_mdio_write(tp, 0x06, 0x7dfe);
18041 rtl8168_mdio_write(tp, 0x06, 0xef96);
18042 rtl8168_mdio_write(tp, 0x06, 0xfec6);
18043 rtl8168_mdio_write(tp, 0x06, 0xfefd);
18044 rtl8168_mdio_write(tp, 0x06, 0xfc05);
18045 rtl8168_mdio_write(tp, 0x06, 0xf9e2);
18046 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
18047 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
18048 rtl8168_mdio_write(tp, 0x06, 0xeb5a);
18049 rtl8168_mdio_write(tp, 0x06, 0x070c);
18050 rtl8168_mdio_write(tp, 0x06, 0x031e);
18051 rtl8168_mdio_write(tp, 0x06, 0x20e6);
18052 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
18053 rtl8168_mdio_write(tp, 0x06, 0xe7e0);
18054 rtl8168_mdio_write(tp, 0x06, 0xebe0);
18055 rtl8168_mdio_write(tp, 0x06, 0xe0fc);
18056 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
18057 rtl8168_mdio_write(tp, 0x06, 0xfdfd);
18058 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18059 rtl8168_mdio_write(tp, 0x06, 0xfaef);
18060 rtl8168_mdio_write(tp, 0x06, 0x69e0);
18061 rtl8168_mdio_write(tp, 0x06, 0x8b80);
18062 rtl8168_mdio_write(tp, 0x06, 0xad27);
18063 rtl8168_mdio_write(tp, 0x06, 0x22bf);
18064 rtl8168_mdio_write(tp, 0x06, 0x4616);
18065 rtl8168_mdio_write(tp, 0x06, 0x0238);
18066 rtl8168_mdio_write(tp, 0x06, 0x50e0);
18067 rtl8168_mdio_write(tp, 0x06, 0x8b44);
18068 rtl8168_mdio_write(tp, 0x06, 0x1f01);
18069 rtl8168_mdio_write(tp, 0x06, 0x9e15);
18070 rtl8168_mdio_write(tp, 0x06, 0xe58b);
18071 rtl8168_mdio_write(tp, 0x06, 0x44ad);
18072 rtl8168_mdio_write(tp, 0x06, 0x2907);
18073 rtl8168_mdio_write(tp, 0x06, 0xac28);
18074 rtl8168_mdio_write(tp, 0x06, 0x04d1);
18075 rtl8168_mdio_write(tp, 0x06, 0x01ae);
18076 rtl8168_mdio_write(tp, 0x06, 0x02d1);
18077 rtl8168_mdio_write(tp, 0x06, 0x00bf);
18078 rtl8168_mdio_write(tp, 0x06, 0x85b0);
18079 rtl8168_mdio_write(tp, 0x06, 0x0238);
18080 rtl8168_mdio_write(tp, 0x06, 0x7def);
18081 rtl8168_mdio_write(tp, 0x06, 0x96fe);
18082 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18083 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
18084 rtl8168_mdio_write(tp, 0x06, 0x8b85);
18085 rtl8168_mdio_write(tp, 0x06, 0xad26);
18086 rtl8168_mdio_write(tp, 0x06, 0x30e0);
18087 rtl8168_mdio_write(tp, 0x06, 0xe036);
18088 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
18089 rtl8168_mdio_write(tp, 0x06, 0x37e1);
18090 rtl8168_mdio_write(tp, 0x06, 0x8b3f);
18091 rtl8168_mdio_write(tp, 0x06, 0x1f10);
18092 rtl8168_mdio_write(tp, 0x06, 0x9e23);
18093 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18094 rtl8168_mdio_write(tp, 0x06, 0x3fac);
18095 rtl8168_mdio_write(tp, 0x06, 0x200b);
18096 rtl8168_mdio_write(tp, 0x06, 0xac21);
18097 rtl8168_mdio_write(tp, 0x06, 0x0dac);
18098 rtl8168_mdio_write(tp, 0x06, 0x250f);
18099 rtl8168_mdio_write(tp, 0x06, 0xac27);
18100 rtl8168_mdio_write(tp, 0x06, 0x11ae);
18101 rtl8168_mdio_write(tp, 0x06, 0x1202);
18102 rtl8168_mdio_write(tp, 0x06, 0x2c47);
18103 rtl8168_mdio_write(tp, 0x06, 0xae0d);
18104 rtl8168_mdio_write(tp, 0x06, 0x0285);
18105 rtl8168_mdio_write(tp, 0x06, 0x4fae);
18106 rtl8168_mdio_write(tp, 0x06, 0x0802);
18107 rtl8168_mdio_write(tp, 0x06, 0x2c69);
18108 rtl8168_mdio_write(tp, 0x06, 0xae03);
18109 rtl8168_mdio_write(tp, 0x06, 0x022c);
18110 rtl8168_mdio_write(tp, 0x06, 0x7cfc);
18111 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18112 rtl8168_mdio_write(tp, 0x06, 0xfaef);
18113 rtl8168_mdio_write(tp, 0x06, 0x6902);
18114 rtl8168_mdio_write(tp, 0x06, 0x856c);
18115 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
18116 rtl8168_mdio_write(tp, 0x06, 0x14e1);
18117 rtl8168_mdio_write(tp, 0x06, 0xe015);
18118 rtl8168_mdio_write(tp, 0x06, 0xad26);
18119 rtl8168_mdio_write(tp, 0x06, 0x08d1);
18120 rtl8168_mdio_write(tp, 0x06, 0x1ebf);
18121 rtl8168_mdio_write(tp, 0x06, 0x2cd9);
18122 rtl8168_mdio_write(tp, 0x06, 0x0238);
18123 rtl8168_mdio_write(tp, 0x06, 0x7def);
18124 rtl8168_mdio_write(tp, 0x06, 0x96fe);
18125 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18126 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
18127 rtl8168_mdio_write(tp, 0x06, 0x8b85);
18128 rtl8168_mdio_write(tp, 0x06, 0xad27);
18129 rtl8168_mdio_write(tp, 0x06, 0x2fd0);
18130 rtl8168_mdio_write(tp, 0x06, 0x0b02);
18131 rtl8168_mdio_write(tp, 0x06, 0x3682);
18132 rtl8168_mdio_write(tp, 0x06, 0x5882);
18133 rtl8168_mdio_write(tp, 0x06, 0x7882);
18134 rtl8168_mdio_write(tp, 0x06, 0x9f24);
18135 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18136 rtl8168_mdio_write(tp, 0x06, 0x32e1);
18137 rtl8168_mdio_write(tp, 0x06, 0x8b33);
18138 rtl8168_mdio_write(tp, 0x06, 0x1f10);
18139 rtl8168_mdio_write(tp, 0x06, 0x9e1a);
18140 rtl8168_mdio_write(tp, 0x06, 0x10e4);
18141 rtl8168_mdio_write(tp, 0x06, 0x8b32);
18142 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
18143 rtl8168_mdio_write(tp, 0x06, 0x28e1);
18144 rtl8168_mdio_write(tp, 0x06, 0xe029);
18145 rtl8168_mdio_write(tp, 0x06, 0xf72c);
18146 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
18147 rtl8168_mdio_write(tp, 0x06, 0x28e5);
18148 rtl8168_mdio_write(tp, 0x06, 0xe029);
18149 rtl8168_mdio_write(tp, 0x06, 0xf62c);
18150 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
18151 rtl8168_mdio_write(tp, 0x06, 0x28e5);
18152 rtl8168_mdio_write(tp, 0x06, 0xe029);
18153 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18154 rtl8168_mdio_write(tp, 0x06, 0x00e1);
18155 rtl8168_mdio_write(tp, 0x06, 0x4077);
18156 rtl8168_mdio_write(tp, 0x06, 0xe140);
18157 rtl8168_mdio_write(tp, 0x06, 0x52e0);
18158 rtl8168_mdio_write(tp, 0x06, 0xeed9);
18159 rtl8168_mdio_write(tp, 0x06, 0xe04c);
18160 rtl8168_mdio_write(tp, 0x06, 0xbbe0);
18161 rtl8168_mdio_write(tp, 0x06, 0x2a00);
18162 rtl8168_mdio_write(tp, 0x05, 0xe142);
18163 gphy_val = rtl8168_mdio_read(tp, 0x06);
18164 gphy_val |= BIT_0;
18165 rtl8168_mdio_write(tp,0x06, gphy_val);
18166 rtl8168_mdio_write(tp, 0x05, 0xe140);
18167 gphy_val = rtl8168_mdio_read(tp, 0x06);
18168 gphy_val |= BIT_0;
18169 rtl8168_mdio_write(tp,0x06, gphy_val);
18170 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18171 rtl8168_mdio_write(tp,0x1f, 0x0005);
18172 for (i = 0; i < 200; i++) {
18173 udelay(100);
18174 gphy_val = rtl8168_mdio_read(tp, 0x00);
18175 if (gphy_val & BIT_7)
18176 break;
18177 }
18178 rtl8168_mdio_write(tp, 0x1f, 0x0007);
18179 rtl8168_mdio_write(tp, 0x1e, 0x0023);
18180 gphy_val = rtl8168_mdio_read(tp, 0x17);
18181 gphy_val |= BIT_1;
18182 if (tp->RequiredSecLanDonglePatch)
18183 gphy_val &= ~BIT_2;
18184 rtl8168_mdio_write(tp, 0x17, gphy_val);
18185 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18186
18187 rtl8168_mdio_write(tp, 0x1F, 0x0003);
18188 rtl8168_mdio_write(tp, 0x09, 0xA20F);
18189 rtl8168_mdio_write(tp, 0x1F, 0x0000);
18190 rtl8168_mdio_write(tp, 0x1f, 0x0003);
18191 rtl8168_mdio_write(tp, 0x01, 0x328A);
18192 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18193
18194 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18195 rtl8168_mdio_write(tp, 0x00, 0x9200);
18196 }
18197
18198 static void
rtl8168_set_phy_mcu_8168f_2(struct net_device * dev)18199 rtl8168_set_phy_mcu_8168f_2(struct net_device *dev)
18200 {
18201 struct rtl8168_private *tp = netdev_priv(dev);
18202 unsigned int gphy_val,i;
18203
18204 rtl8168_mdio_write(tp,0x1f, 0x0000);
18205 rtl8168_mdio_write(tp,0x00, 0x1800);
18206 gphy_val = rtl8168_mdio_read(tp, 0x15);
18207 gphy_val &= ~(BIT_12);
18208 rtl8168_mdio_write(tp,0x15, gphy_val);
18209 rtl8168_mdio_write(tp,0x00, 0x4800);
18210 rtl8168_mdio_write(tp,0x1f, 0x0007);
18211 rtl8168_mdio_write(tp,0x1e, 0x002f);
18212 for (i = 0; i < 1000; i++) {
18213 udelay(100);
18214 gphy_val = rtl8168_mdio_read(tp, 0x1c);
18215 if (gphy_val & 0x0080)
18216 break;
18217 }
18218 rtl8168_mdio_write(tp,0x1f, 0x0000);
18219 rtl8168_mdio_write(tp,0x00, 0x1800);
18220 rtl8168_mdio_write(tp,0x1f, 0x0007);
18221 rtl8168_mdio_write(tp,0x1e, 0x0023);
18222 for (i = 0; i < 200; i++) {
18223 udelay(100);
18224 gphy_val = rtl8168_mdio_read(tp, 0x18);
18225 if (!(gphy_val & 0x0001))
18226 break;
18227 }
18228 rtl8168_mdio_write(tp, 0x1f, 0x0005);
18229 rtl8168_mdio_write(tp, 0x05, 0xfff6);
18230 rtl8168_mdio_write(tp, 0x06, 0x0080);
18231 rtl8168_mdio_write(tp, 0x1f, 0x0007);
18232 rtl8168_mdio_write(tp, 0x1e, 0x0023);
18233 rtl8168_mdio_write(tp, 0x16, 0x0306);
18234 rtl8168_mdio_write(tp, 0x16, 0x0307);
18235 rtl8168_mdio_write(tp, 0x15, 0x0098);
18236 rtl8168_mdio_write(tp, 0x19, 0x7c0b);
18237 rtl8168_mdio_write(tp, 0x15, 0x0099);
18238 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
18239 rtl8168_mdio_write(tp, 0x15, 0x00eb);
18240 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
18241 rtl8168_mdio_write(tp, 0x15, 0x00f8);
18242 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
18243 rtl8168_mdio_write(tp, 0x15, 0x00fe);
18244 rtl8168_mdio_write(tp, 0x19, 0x6f0f);
18245 rtl8168_mdio_write(tp, 0x15, 0x00db);
18246 rtl8168_mdio_write(tp, 0x19, 0x6f09);
18247 rtl8168_mdio_write(tp, 0x15, 0x00dc);
18248 rtl8168_mdio_write(tp, 0x19, 0xaefd);
18249 rtl8168_mdio_write(tp, 0x15, 0x00dd);
18250 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
18251 rtl8168_mdio_write(tp, 0x15, 0x00de);
18252 rtl8168_mdio_write(tp, 0x19, 0xc60b);
18253 rtl8168_mdio_write(tp, 0x15, 0x00df);
18254 rtl8168_mdio_write(tp, 0x19, 0x00fa);
18255 rtl8168_mdio_write(tp, 0x15, 0x00e0);
18256 rtl8168_mdio_write(tp, 0x19, 0x30e1);
18257 rtl8168_mdio_write(tp, 0x15, 0x020c);
18258 rtl8168_mdio_write(tp, 0x19, 0x3224);
18259 rtl8168_mdio_write(tp, 0x15, 0x020e);
18260 rtl8168_mdio_write(tp, 0x19, 0x9813);
18261 rtl8168_mdio_write(tp, 0x15, 0x020f);
18262 rtl8168_mdio_write(tp, 0x19, 0x7801);
18263 rtl8168_mdio_write(tp, 0x15, 0x0210);
18264 rtl8168_mdio_write(tp, 0x19, 0x930f);
18265 rtl8168_mdio_write(tp, 0x15, 0x0211);
18266 rtl8168_mdio_write(tp, 0x19, 0x9206);
18267 rtl8168_mdio_write(tp, 0x15, 0x0212);
18268 rtl8168_mdio_write(tp, 0x19, 0x4002);
18269 rtl8168_mdio_write(tp, 0x15, 0x0213);
18270 rtl8168_mdio_write(tp, 0x19, 0x7800);
18271 rtl8168_mdio_write(tp, 0x15, 0x0214);
18272 rtl8168_mdio_write(tp, 0x19, 0x588f);
18273 rtl8168_mdio_write(tp, 0x15, 0x0215);
18274 rtl8168_mdio_write(tp, 0x19, 0x5520);
18275 rtl8168_mdio_write(tp, 0x15, 0x0216);
18276 rtl8168_mdio_write(tp, 0x19, 0x3224);
18277 rtl8168_mdio_write(tp, 0x15, 0x0217);
18278 rtl8168_mdio_write(tp, 0x19, 0x4002);
18279 rtl8168_mdio_write(tp, 0x15, 0x0218);
18280 rtl8168_mdio_write(tp, 0x19, 0x7800);
18281 rtl8168_mdio_write(tp, 0x15, 0x0219);
18282 rtl8168_mdio_write(tp, 0x19, 0x588d);
18283 rtl8168_mdio_write(tp, 0x15, 0x021a);
18284 rtl8168_mdio_write(tp, 0x19, 0x5540);
18285 rtl8168_mdio_write(tp, 0x15, 0x021b);
18286 rtl8168_mdio_write(tp, 0x19, 0x9e03);
18287 rtl8168_mdio_write(tp, 0x15, 0x021c);
18288 rtl8168_mdio_write(tp, 0x19, 0x7c40);
18289 rtl8168_mdio_write(tp, 0x15, 0x021d);
18290 rtl8168_mdio_write(tp, 0x19, 0x6840);
18291 rtl8168_mdio_write(tp, 0x15, 0x021e);
18292 rtl8168_mdio_write(tp, 0x19, 0x3224);
18293 rtl8168_mdio_write(tp, 0x15, 0x021f);
18294 rtl8168_mdio_write(tp, 0x19, 0x4002);
18295 rtl8168_mdio_write(tp, 0x15, 0x0220);
18296 rtl8168_mdio_write(tp, 0x19, 0x3224);
18297 rtl8168_mdio_write(tp, 0x15, 0x0221);
18298 rtl8168_mdio_write(tp, 0x19, 0x9e03);
18299 rtl8168_mdio_write(tp, 0x15, 0x0222);
18300 rtl8168_mdio_write(tp, 0x19, 0x7c40);
18301 rtl8168_mdio_write(tp, 0x15, 0x0223);
18302 rtl8168_mdio_write(tp, 0x19, 0x6840);
18303 rtl8168_mdio_write(tp, 0x15, 0x0224);
18304 rtl8168_mdio_write(tp, 0x19, 0x7800);
18305 rtl8168_mdio_write(tp, 0x15, 0x0225);
18306 rtl8168_mdio_write(tp, 0x19, 0x3231);
18307 rtl8168_mdio_write(tp, 0x15, 0x0000);
18308 rtl8168_mdio_write(tp, 0x16, 0x0306);
18309 rtl8168_mdio_write(tp, 0x16, 0x0300);
18310 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18311 rtl8168_mdio_write(tp, 0x1f, 0x0005);
18312 rtl8168_mdio_write(tp, 0x05, 0xfff6);
18313 rtl8168_mdio_write(tp, 0x06, 0x0080);
18314 rtl8168_mdio_write(tp, 0x05, 0x8000);
18315 rtl8168_mdio_write(tp, 0x06, 0x0280);
18316 rtl8168_mdio_write(tp, 0x06, 0x48f7);
18317 rtl8168_mdio_write(tp, 0x06, 0x00e0);
18318 rtl8168_mdio_write(tp, 0x06, 0xfff7);
18319 rtl8168_mdio_write(tp, 0x06, 0xa080);
18320 rtl8168_mdio_write(tp, 0x06, 0x02ae);
18321 rtl8168_mdio_write(tp, 0x06, 0xf602);
18322 rtl8168_mdio_write(tp, 0x06, 0x011b);
18323 rtl8168_mdio_write(tp, 0x06, 0x0201);
18324 rtl8168_mdio_write(tp, 0x06, 0x2802);
18325 rtl8168_mdio_write(tp, 0x06, 0x0135);
18326 rtl8168_mdio_write(tp, 0x06, 0x0201);
18327 rtl8168_mdio_write(tp, 0x06, 0x4502);
18328 rtl8168_mdio_write(tp, 0x06, 0x015f);
18329 rtl8168_mdio_write(tp, 0x06, 0x0280);
18330 rtl8168_mdio_write(tp, 0x06, 0x6b02);
18331 rtl8168_mdio_write(tp, 0x06, 0x80e5);
18332 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18333 rtl8168_mdio_write(tp, 0x06, 0x88e1);
18334 rtl8168_mdio_write(tp, 0x06, 0x8b89);
18335 rtl8168_mdio_write(tp, 0x06, 0x1e01);
18336 rtl8168_mdio_write(tp, 0x06, 0xe18b);
18337 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
18338 rtl8168_mdio_write(tp, 0x06, 0x01e1);
18339 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
18340 rtl8168_mdio_write(tp, 0x06, 0x1e01);
18341 rtl8168_mdio_write(tp, 0x06, 0xe18b);
18342 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
18343 rtl8168_mdio_write(tp, 0x06, 0x01e1);
18344 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
18345 rtl8168_mdio_write(tp, 0x06, 0x1e01);
18346 rtl8168_mdio_write(tp, 0x06, 0xe18b);
18347 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
18348 rtl8168_mdio_write(tp, 0x06, 0x01a0);
18349 rtl8168_mdio_write(tp, 0x06, 0x00c7);
18350 rtl8168_mdio_write(tp, 0x06, 0xaebb);
18351 rtl8168_mdio_write(tp, 0x06, 0xbf8b);
18352 rtl8168_mdio_write(tp, 0x06, 0x88ec);
18353 rtl8168_mdio_write(tp, 0x06, 0x0019);
18354 rtl8168_mdio_write(tp, 0x06, 0xa98b);
18355 rtl8168_mdio_write(tp, 0x06, 0x90f9);
18356 rtl8168_mdio_write(tp, 0x06, 0xeeff);
18357 rtl8168_mdio_write(tp, 0x06, 0xf600);
18358 rtl8168_mdio_write(tp, 0x06, 0xeeff);
18359 rtl8168_mdio_write(tp, 0x06, 0xf7fe);
18360 rtl8168_mdio_write(tp, 0x06, 0xd100);
18361 rtl8168_mdio_write(tp, 0x06, 0xbf81);
18362 rtl8168_mdio_write(tp, 0x06, 0x9802);
18363 rtl8168_mdio_write(tp, 0x06, 0x39f3);
18364 rtl8168_mdio_write(tp, 0x06, 0xd101);
18365 rtl8168_mdio_write(tp, 0x06, 0xbf81);
18366 rtl8168_mdio_write(tp, 0x06, 0x9b02);
18367 rtl8168_mdio_write(tp, 0x06, 0x39f3);
18368 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18369 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18370 rtl8168_mdio_write(tp, 0x06, 0x8dad);
18371 rtl8168_mdio_write(tp, 0x06, 0x2014);
18372 rtl8168_mdio_write(tp, 0x06, 0xee8b);
18373 rtl8168_mdio_write(tp, 0x06, 0x8d00);
18374 rtl8168_mdio_write(tp, 0x06, 0xe08a);
18375 rtl8168_mdio_write(tp, 0x06, 0x5a78);
18376 rtl8168_mdio_write(tp, 0x06, 0x039e);
18377 rtl8168_mdio_write(tp, 0x06, 0x0902);
18378 rtl8168_mdio_write(tp, 0x06, 0x05fc);
18379 rtl8168_mdio_write(tp, 0x06, 0x0280);
18380 rtl8168_mdio_write(tp, 0x06, 0x8802);
18381 rtl8168_mdio_write(tp, 0x06, 0x32dd);
18382 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18383 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
18384 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18385 rtl8168_mdio_write(tp, 0x06, 0x81ac);
18386 rtl8168_mdio_write(tp, 0x06, 0x261a);
18387 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18388 rtl8168_mdio_write(tp, 0x06, 0x81ac);
18389 rtl8168_mdio_write(tp, 0x06, 0x2114);
18390 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18391 rtl8168_mdio_write(tp, 0x06, 0x85ac);
18392 rtl8168_mdio_write(tp, 0x06, 0x200e);
18393 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18394 rtl8168_mdio_write(tp, 0x06, 0x85ac);
18395 rtl8168_mdio_write(tp, 0x06, 0x2308);
18396 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18397 rtl8168_mdio_write(tp, 0x06, 0x87ac);
18398 rtl8168_mdio_write(tp, 0x06, 0x2402);
18399 rtl8168_mdio_write(tp, 0x06, 0xae38);
18400 rtl8168_mdio_write(tp, 0x06, 0x021a);
18401 rtl8168_mdio_write(tp, 0x06, 0xd6ee);
18402 rtl8168_mdio_write(tp, 0x06, 0xe41c);
18403 rtl8168_mdio_write(tp, 0x06, 0x04ee);
18404 rtl8168_mdio_write(tp, 0x06, 0xe41d);
18405 rtl8168_mdio_write(tp, 0x06, 0x04e2);
18406 rtl8168_mdio_write(tp, 0x06, 0xe07c);
18407 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
18408 rtl8168_mdio_write(tp, 0x06, 0x7de0);
18409 rtl8168_mdio_write(tp, 0x06, 0xe038);
18410 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
18411 rtl8168_mdio_write(tp, 0x06, 0x39ad);
18412 rtl8168_mdio_write(tp, 0x06, 0x2e1b);
18413 rtl8168_mdio_write(tp, 0x06, 0xad39);
18414 rtl8168_mdio_write(tp, 0x06, 0x0dd1);
18415 rtl8168_mdio_write(tp, 0x06, 0x01bf);
18416 rtl8168_mdio_write(tp, 0x06, 0x22c8);
18417 rtl8168_mdio_write(tp, 0x06, 0x0239);
18418 rtl8168_mdio_write(tp, 0x06, 0xf302);
18419 rtl8168_mdio_write(tp, 0x06, 0x21f0);
18420 rtl8168_mdio_write(tp, 0x06, 0xae0b);
18421 rtl8168_mdio_write(tp, 0x06, 0xac38);
18422 rtl8168_mdio_write(tp, 0x06, 0x02ae);
18423 rtl8168_mdio_write(tp, 0x06, 0x0602);
18424 rtl8168_mdio_write(tp, 0x06, 0x222d);
18425 rtl8168_mdio_write(tp, 0x06, 0x0222);
18426 rtl8168_mdio_write(tp, 0x06, 0x7202);
18427 rtl8168_mdio_write(tp, 0x06, 0x1ae7);
18428 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
18429 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18430 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18431 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18432 rtl8168_mdio_write(tp, 0x06, 0x201a);
18433 rtl8168_mdio_write(tp, 0x06, 0xf620);
18434 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18435 rtl8168_mdio_write(tp, 0x06, 0x8e02);
18436 rtl8168_mdio_write(tp, 0x06, 0x2afe);
18437 rtl8168_mdio_write(tp, 0x06, 0x022c);
18438 rtl8168_mdio_write(tp, 0x06, 0x5c02);
18439 rtl8168_mdio_write(tp, 0x06, 0x03c5);
18440 rtl8168_mdio_write(tp, 0x06, 0x0281);
18441 rtl8168_mdio_write(tp, 0x06, 0x6702);
18442 rtl8168_mdio_write(tp, 0x06, 0x2e4f);
18443 rtl8168_mdio_write(tp, 0x06, 0x0204);
18444 rtl8168_mdio_write(tp, 0x06, 0x8902);
18445 rtl8168_mdio_write(tp, 0x06, 0x2f7a);
18446 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18447 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18448 rtl8168_mdio_write(tp, 0x06, 0x210b);
18449 rtl8168_mdio_write(tp, 0x06, 0xf621);
18450 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18451 rtl8168_mdio_write(tp, 0x06, 0x8e02);
18452 rtl8168_mdio_write(tp, 0x06, 0x0445);
18453 rtl8168_mdio_write(tp, 0x06, 0x021c);
18454 rtl8168_mdio_write(tp, 0x06, 0xb8e0);
18455 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18456 rtl8168_mdio_write(tp, 0x06, 0xad22);
18457 rtl8168_mdio_write(tp, 0x06, 0x08f6);
18458 rtl8168_mdio_write(tp, 0x06, 0x22e4);
18459 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18460 rtl8168_mdio_write(tp, 0x06, 0x0235);
18461 rtl8168_mdio_write(tp, 0x06, 0xd4e0);
18462 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18463 rtl8168_mdio_write(tp, 0x06, 0xad23);
18464 rtl8168_mdio_write(tp, 0x06, 0x08f6);
18465 rtl8168_mdio_write(tp, 0x06, 0x23e4);
18466 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18467 rtl8168_mdio_write(tp, 0x06, 0x0231);
18468 rtl8168_mdio_write(tp, 0x06, 0xc8e0);
18469 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18470 rtl8168_mdio_write(tp, 0x06, 0xad24);
18471 rtl8168_mdio_write(tp, 0x06, 0x05f6);
18472 rtl8168_mdio_write(tp, 0x06, 0x24e4);
18473 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18474 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18475 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18476 rtl8168_mdio_write(tp, 0x06, 0x2505);
18477 rtl8168_mdio_write(tp, 0x06, 0xf625);
18478 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18479 rtl8168_mdio_write(tp, 0x06, 0x8ee0);
18480 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18481 rtl8168_mdio_write(tp, 0x06, 0xad26);
18482 rtl8168_mdio_write(tp, 0x06, 0x08f6);
18483 rtl8168_mdio_write(tp, 0x06, 0x26e4);
18484 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18485 rtl8168_mdio_write(tp, 0x06, 0x022d);
18486 rtl8168_mdio_write(tp, 0x06, 0x6ae0);
18487 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18488 rtl8168_mdio_write(tp, 0x06, 0xad27);
18489 rtl8168_mdio_write(tp, 0x06, 0x05f6);
18490 rtl8168_mdio_write(tp, 0x06, 0x27e4);
18491 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18492 rtl8168_mdio_write(tp, 0x06, 0x0203);
18493 rtl8168_mdio_write(tp, 0x06, 0x8bfc);
18494 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18495 rtl8168_mdio_write(tp, 0x06, 0xfaef);
18496 rtl8168_mdio_write(tp, 0x06, 0x69e0);
18497 rtl8168_mdio_write(tp, 0x06, 0x8b80);
18498 rtl8168_mdio_write(tp, 0x06, 0xad27);
18499 rtl8168_mdio_write(tp, 0x06, 0x22bf);
18500 rtl8168_mdio_write(tp, 0x06, 0x479a);
18501 rtl8168_mdio_write(tp, 0x06, 0x0239);
18502 rtl8168_mdio_write(tp, 0x06, 0xc6e0);
18503 rtl8168_mdio_write(tp, 0x06, 0x8b44);
18504 rtl8168_mdio_write(tp, 0x06, 0x1f01);
18505 rtl8168_mdio_write(tp, 0x06, 0x9e15);
18506 rtl8168_mdio_write(tp, 0x06, 0xe58b);
18507 rtl8168_mdio_write(tp, 0x06, 0x44ad);
18508 rtl8168_mdio_write(tp, 0x06, 0x2907);
18509 rtl8168_mdio_write(tp, 0x06, 0xac28);
18510 rtl8168_mdio_write(tp, 0x06, 0x04d1);
18511 rtl8168_mdio_write(tp, 0x06, 0x01ae);
18512 rtl8168_mdio_write(tp, 0x06, 0x02d1);
18513 rtl8168_mdio_write(tp, 0x06, 0x00bf);
18514 rtl8168_mdio_write(tp, 0x06, 0x819e);
18515 rtl8168_mdio_write(tp, 0x06, 0x0239);
18516 rtl8168_mdio_write(tp, 0x06, 0xf3ef);
18517 rtl8168_mdio_write(tp, 0x06, 0x96fe);
18518 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18519 rtl8168_mdio_write(tp, 0x06, 0x00e1);
18520 rtl8168_mdio_write(tp, 0x06, 0x4077);
18521 rtl8168_mdio_write(tp, 0x06, 0xe140);
18522 rtl8168_mdio_write(tp, 0x06, 0xbbe0);
18523 rtl8168_mdio_write(tp, 0x06, 0x2a00);
18524 rtl8168_mdio_write(tp, 0x05, 0xe142);
18525 gphy_val = rtl8168_mdio_read(tp, 0x06);
18526 gphy_val |= BIT_0;
18527 rtl8168_mdio_write(tp, 0x06, gphy_val);
18528 rtl8168_mdio_write(tp, 0x05, 0xe140);
18529 gphy_val = rtl8168_mdio_read(tp, 0x06);
18530 gphy_val |= BIT_0;
18531 rtl8168_mdio_write(tp, 0x06, gphy_val);
18532 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18533 rtl8168_mdio_write(tp,0x1f, 0x0005);
18534 for (i = 0; i < 200; i++) {
18535 udelay(100);
18536 gphy_val = rtl8168_mdio_read(tp, 0x00);
18537 if (gphy_val & BIT_7)
18538 break;
18539 }
18540 rtl8168_mdio_write(tp, 0x1f, 0x0007);
18541 rtl8168_mdio_write(tp, 0x1e, 0x0023);
18542 gphy_val = rtl8168_mdio_read(tp, 0x17);
18543 gphy_val |= BIT_1;
18544 if (tp->RequiredSecLanDonglePatch)
18545 gphy_val &= ~BIT_2;
18546 rtl8168_mdio_write(tp, 0x17, gphy_val);
18547 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18548 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18549 rtl8168_mdio_write(tp, 0x00, 0x9200);
18550 }
18551
18552 static void
rtl8168_set_phy_mcu_8411_1(struct net_device * dev)18553 rtl8168_set_phy_mcu_8411_1(struct net_device *dev)
18554 {
18555 struct rtl8168_private *tp = netdev_priv(dev);
18556 unsigned int gphy_val,i;
18557
18558 rtl8168_mdio_write(tp,0x1f, 0x0000);
18559 rtl8168_mdio_write(tp,0x00, 0x1800);
18560 gphy_val = rtl8168_mdio_read(tp, 0x15);
18561 gphy_val &= ~(BIT_12);
18562 rtl8168_mdio_write(tp,0x15, gphy_val);
18563 rtl8168_mdio_write(tp,0x00, 0x4800);
18564 rtl8168_mdio_write(tp,0x1f, 0x0007);
18565 rtl8168_mdio_write(tp,0x1e, 0x002f);
18566 for (i = 0; i < 1000; i++) {
18567 udelay(100);
18568 gphy_val = rtl8168_mdio_read(tp, 0x1c);
18569 if (gphy_val & 0x0080)
18570 break;
18571 }
18572 rtl8168_mdio_write(tp,0x1f, 0x0000);
18573 rtl8168_mdio_write(tp,0x00, 0x1800);
18574 rtl8168_mdio_write(tp,0x1f, 0x0007);
18575 rtl8168_mdio_write(tp,0x1e, 0x0023);
18576 for (i = 0; i < 200; i++) {
18577 udelay(100);
18578 gphy_val = rtl8168_mdio_read(tp, 0x18);
18579 if (!(gphy_val & 0x0001))
18580 break;
18581 }
18582 rtl8168_mdio_write(tp,0x1f, 0x0005);
18583 rtl8168_mdio_write(tp,0x05, 0xfff6);
18584 rtl8168_mdio_write(tp,0x06, 0x0080);
18585 rtl8168_mdio_write(tp, 0x1f, 0x0007);
18586 rtl8168_mdio_write(tp, 0x1e, 0x0023);
18587 rtl8168_mdio_write(tp, 0x16, 0x0306);
18588 rtl8168_mdio_write(tp, 0x16, 0x0307);
18589 rtl8168_mdio_write(tp, 0x15, 0x0098);
18590 rtl8168_mdio_write(tp, 0x19, 0x7c0b);
18591 rtl8168_mdio_write(tp, 0x15, 0x0099);
18592 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
18593 rtl8168_mdio_write(tp, 0x15, 0x00eb);
18594 rtl8168_mdio_write(tp, 0x19, 0x6c0b);
18595 rtl8168_mdio_write(tp, 0x15, 0x00f8);
18596 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
18597 rtl8168_mdio_write(tp, 0x15, 0x00fe);
18598 rtl8168_mdio_write(tp, 0x19, 0x6f0f);
18599 rtl8168_mdio_write(tp, 0x15, 0x00db);
18600 rtl8168_mdio_write(tp, 0x19, 0x6f09);
18601 rtl8168_mdio_write(tp, 0x15, 0x00dc);
18602 rtl8168_mdio_write(tp, 0x19, 0xaefd);
18603 rtl8168_mdio_write(tp, 0x15, 0x00dd);
18604 rtl8168_mdio_write(tp, 0x19, 0x6f0b);
18605 rtl8168_mdio_write(tp, 0x15, 0x00de);
18606 rtl8168_mdio_write(tp, 0x19, 0xc60b);
18607 rtl8168_mdio_write(tp, 0x15, 0x00df);
18608 rtl8168_mdio_write(tp, 0x19, 0x00fa);
18609 rtl8168_mdio_write(tp, 0x15, 0x00e0);
18610 rtl8168_mdio_write(tp, 0x19, 0x30e1);
18611 rtl8168_mdio_write(tp, 0x15, 0x020c);
18612 rtl8168_mdio_write(tp, 0x19, 0x3224);
18613 rtl8168_mdio_write(tp, 0x15, 0x020e);
18614 rtl8168_mdio_write(tp, 0x19, 0x9813);
18615 rtl8168_mdio_write(tp, 0x15, 0x020f);
18616 rtl8168_mdio_write(tp, 0x19, 0x7801);
18617 rtl8168_mdio_write(tp, 0x15, 0x0210);
18618 rtl8168_mdio_write(tp, 0x19, 0x930f);
18619 rtl8168_mdio_write(tp, 0x15, 0x0211);
18620 rtl8168_mdio_write(tp, 0x19, 0x9206);
18621 rtl8168_mdio_write(tp, 0x15, 0x0212);
18622 rtl8168_mdio_write(tp, 0x19, 0x4002);
18623 rtl8168_mdio_write(tp, 0x15, 0x0213);
18624 rtl8168_mdio_write(tp, 0x19, 0x7800);
18625 rtl8168_mdio_write(tp, 0x15, 0x0214);
18626 rtl8168_mdio_write(tp, 0x19, 0x588f);
18627 rtl8168_mdio_write(tp, 0x15, 0x0215);
18628 rtl8168_mdio_write(tp, 0x19, 0x5520);
18629 rtl8168_mdio_write(tp, 0x15, 0x0216);
18630 rtl8168_mdio_write(tp, 0x19, 0x3224);
18631 rtl8168_mdio_write(tp, 0x15, 0x0217);
18632 rtl8168_mdio_write(tp, 0x19, 0x4002);
18633 rtl8168_mdio_write(tp, 0x15, 0x0218);
18634 rtl8168_mdio_write(tp, 0x19, 0x7800);
18635 rtl8168_mdio_write(tp, 0x15, 0x0219);
18636 rtl8168_mdio_write(tp, 0x19, 0x588d);
18637 rtl8168_mdio_write(tp, 0x15, 0x021a);
18638 rtl8168_mdio_write(tp, 0x19, 0x5540);
18639 rtl8168_mdio_write(tp, 0x15, 0x021b);
18640 rtl8168_mdio_write(tp, 0x19, 0x9e03);
18641 rtl8168_mdio_write(tp, 0x15, 0x021c);
18642 rtl8168_mdio_write(tp, 0x19, 0x7c40);
18643 rtl8168_mdio_write(tp, 0x15, 0x021d);
18644 rtl8168_mdio_write(tp, 0x19, 0x6840);
18645 rtl8168_mdio_write(tp, 0x15, 0x021e);
18646 rtl8168_mdio_write(tp, 0x19, 0x3224);
18647 rtl8168_mdio_write(tp, 0x15, 0x021f);
18648 rtl8168_mdio_write(tp, 0x19, 0x4002);
18649 rtl8168_mdio_write(tp, 0x15, 0x0220);
18650 rtl8168_mdio_write(tp, 0x19, 0x3224);
18651 rtl8168_mdio_write(tp, 0x15, 0x0221);
18652 rtl8168_mdio_write(tp, 0x19, 0x9e03);
18653 rtl8168_mdio_write(tp, 0x15, 0x0222);
18654 rtl8168_mdio_write(tp, 0x19, 0x7c40);
18655 rtl8168_mdio_write(tp, 0x15, 0x0223);
18656 rtl8168_mdio_write(tp, 0x19, 0x6840);
18657 rtl8168_mdio_write(tp, 0x15, 0x0224);
18658 rtl8168_mdio_write(tp, 0x19, 0x7800);
18659 rtl8168_mdio_write(tp, 0x15, 0x0225);
18660 rtl8168_mdio_write(tp, 0x19, 0x3231);
18661 rtl8168_mdio_write(tp, 0x15, 0x0000);
18662 rtl8168_mdio_write(tp, 0x16, 0x0306);
18663 rtl8168_mdio_write(tp, 0x16, 0x0300);
18664 rtl8168_mdio_write(tp, 0x1f, 0x0000);
18665 rtl8168_mdio_write(tp, 0x1f, 0x0005);
18666 rtl8168_mdio_write(tp, 0x05, 0xfff6);
18667 rtl8168_mdio_write(tp, 0x06, 0x0080);
18668 rtl8168_mdio_write(tp, 0x05, 0x8000);
18669 rtl8168_mdio_write(tp, 0x06, 0x0280);
18670 rtl8168_mdio_write(tp, 0x06, 0x48f7);
18671 rtl8168_mdio_write(tp, 0x06, 0x00e0);
18672 rtl8168_mdio_write(tp, 0x06, 0xfff7);
18673 rtl8168_mdio_write(tp, 0x06, 0xa080);
18674 rtl8168_mdio_write(tp, 0x06, 0x02ae);
18675 rtl8168_mdio_write(tp, 0x06, 0xf602);
18676 rtl8168_mdio_write(tp, 0x06, 0x011e);
18677 rtl8168_mdio_write(tp, 0x06, 0x0201);
18678 rtl8168_mdio_write(tp, 0x06, 0x2b02);
18679 rtl8168_mdio_write(tp, 0x06, 0x8077);
18680 rtl8168_mdio_write(tp, 0x06, 0x0201);
18681 rtl8168_mdio_write(tp, 0x06, 0x4802);
18682 rtl8168_mdio_write(tp, 0x06, 0x0162);
18683 rtl8168_mdio_write(tp, 0x06, 0x0280);
18684 rtl8168_mdio_write(tp, 0x06, 0x9402);
18685 rtl8168_mdio_write(tp, 0x06, 0x810e);
18686 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18687 rtl8168_mdio_write(tp, 0x06, 0x88e1);
18688 rtl8168_mdio_write(tp, 0x06, 0x8b89);
18689 rtl8168_mdio_write(tp, 0x06, 0x1e01);
18690 rtl8168_mdio_write(tp, 0x06, 0xe18b);
18691 rtl8168_mdio_write(tp, 0x06, 0x8a1e);
18692 rtl8168_mdio_write(tp, 0x06, 0x01e1);
18693 rtl8168_mdio_write(tp, 0x06, 0x8b8b);
18694 rtl8168_mdio_write(tp, 0x06, 0x1e01);
18695 rtl8168_mdio_write(tp, 0x06, 0xe18b);
18696 rtl8168_mdio_write(tp, 0x06, 0x8c1e);
18697 rtl8168_mdio_write(tp, 0x06, 0x01e1);
18698 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
18699 rtl8168_mdio_write(tp, 0x06, 0x1e01);
18700 rtl8168_mdio_write(tp, 0x06, 0xe18b);
18701 rtl8168_mdio_write(tp, 0x06, 0x8e1e);
18702 rtl8168_mdio_write(tp, 0x06, 0x01a0);
18703 rtl8168_mdio_write(tp, 0x06, 0x00c7);
18704 rtl8168_mdio_write(tp, 0x06, 0xaebb);
18705 rtl8168_mdio_write(tp, 0x06, 0xd481);
18706 rtl8168_mdio_write(tp, 0x06, 0xd4e4);
18707 rtl8168_mdio_write(tp, 0x06, 0x8b92);
18708 rtl8168_mdio_write(tp, 0x06, 0xe58b);
18709 rtl8168_mdio_write(tp, 0x06, 0x9302);
18710 rtl8168_mdio_write(tp, 0x06, 0x2e5a);
18711 rtl8168_mdio_write(tp, 0x06, 0xbf8b);
18712 rtl8168_mdio_write(tp, 0x06, 0x88ec);
18713 rtl8168_mdio_write(tp, 0x06, 0x0019);
18714 rtl8168_mdio_write(tp, 0x06, 0xa98b);
18715 rtl8168_mdio_write(tp, 0x06, 0x90f9);
18716 rtl8168_mdio_write(tp, 0x06, 0xeeff);
18717 rtl8168_mdio_write(tp, 0x06, 0xf600);
18718 rtl8168_mdio_write(tp, 0x06, 0xeeff);
18719 rtl8168_mdio_write(tp, 0x06, 0xf7fc);
18720 rtl8168_mdio_write(tp, 0x06, 0xd100);
18721 rtl8168_mdio_write(tp, 0x06, 0xbf83);
18722 rtl8168_mdio_write(tp, 0x06, 0x3c02);
18723 rtl8168_mdio_write(tp, 0x06, 0x3a21);
18724 rtl8168_mdio_write(tp, 0x06, 0xd101);
18725 rtl8168_mdio_write(tp, 0x06, 0xbf83);
18726 rtl8168_mdio_write(tp, 0x06, 0x3f02);
18727 rtl8168_mdio_write(tp, 0x06, 0x3a21);
18728 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18729 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18730 rtl8168_mdio_write(tp, 0x06, 0x8aad);
18731 rtl8168_mdio_write(tp, 0x06, 0x2014);
18732 rtl8168_mdio_write(tp, 0x06, 0xee8b);
18733 rtl8168_mdio_write(tp, 0x06, 0x8a00);
18734 rtl8168_mdio_write(tp, 0x06, 0x0220);
18735 rtl8168_mdio_write(tp, 0x06, 0x8be0);
18736 rtl8168_mdio_write(tp, 0x06, 0xe426);
18737 rtl8168_mdio_write(tp, 0x06, 0xe1e4);
18738 rtl8168_mdio_write(tp, 0x06, 0x27ee);
18739 rtl8168_mdio_write(tp, 0x06, 0xe426);
18740 rtl8168_mdio_write(tp, 0x06, 0x23e5);
18741 rtl8168_mdio_write(tp, 0x06, 0xe427);
18742 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18743 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
18744 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
18745 rtl8168_mdio_write(tp, 0x06, 0xad20);
18746 rtl8168_mdio_write(tp, 0x06, 0x14ee);
18747 rtl8168_mdio_write(tp, 0x06, 0x8b8d);
18748 rtl8168_mdio_write(tp, 0x06, 0x00e0);
18749 rtl8168_mdio_write(tp, 0x06, 0x8a5a);
18750 rtl8168_mdio_write(tp, 0x06, 0x7803);
18751 rtl8168_mdio_write(tp, 0x06, 0x9e09);
18752 rtl8168_mdio_write(tp, 0x06, 0x0206);
18753 rtl8168_mdio_write(tp, 0x06, 0x2802);
18754 rtl8168_mdio_write(tp, 0x06, 0x80b1);
18755 rtl8168_mdio_write(tp, 0x06, 0x0232);
18756 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
18757 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18758 rtl8168_mdio_write(tp, 0x06, 0xf9e0);
18759 rtl8168_mdio_write(tp, 0x06, 0x8b81);
18760 rtl8168_mdio_write(tp, 0x06, 0xac26);
18761 rtl8168_mdio_write(tp, 0x06, 0x1ae0);
18762 rtl8168_mdio_write(tp, 0x06, 0x8b81);
18763 rtl8168_mdio_write(tp, 0x06, 0xac21);
18764 rtl8168_mdio_write(tp, 0x06, 0x14e0);
18765 rtl8168_mdio_write(tp, 0x06, 0x8b85);
18766 rtl8168_mdio_write(tp, 0x06, 0xac20);
18767 rtl8168_mdio_write(tp, 0x06, 0x0ee0);
18768 rtl8168_mdio_write(tp, 0x06, 0x8b85);
18769 rtl8168_mdio_write(tp, 0x06, 0xac23);
18770 rtl8168_mdio_write(tp, 0x06, 0x08e0);
18771 rtl8168_mdio_write(tp, 0x06, 0x8b87);
18772 rtl8168_mdio_write(tp, 0x06, 0xac24);
18773 rtl8168_mdio_write(tp, 0x06, 0x02ae);
18774 rtl8168_mdio_write(tp, 0x06, 0x3802);
18775 rtl8168_mdio_write(tp, 0x06, 0x1b02);
18776 rtl8168_mdio_write(tp, 0x06, 0xeee4);
18777 rtl8168_mdio_write(tp, 0x06, 0x1c04);
18778 rtl8168_mdio_write(tp, 0x06, 0xeee4);
18779 rtl8168_mdio_write(tp, 0x06, 0x1d04);
18780 rtl8168_mdio_write(tp, 0x06, 0xe2e0);
18781 rtl8168_mdio_write(tp, 0x06, 0x7ce3);
18782 rtl8168_mdio_write(tp, 0x06, 0xe07d);
18783 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
18784 rtl8168_mdio_write(tp, 0x06, 0x38e1);
18785 rtl8168_mdio_write(tp, 0x06, 0xe039);
18786 rtl8168_mdio_write(tp, 0x06, 0xad2e);
18787 rtl8168_mdio_write(tp, 0x06, 0x1bad);
18788 rtl8168_mdio_write(tp, 0x06, 0x390d);
18789 rtl8168_mdio_write(tp, 0x06, 0xd101);
18790 rtl8168_mdio_write(tp, 0x06, 0xbf22);
18791 rtl8168_mdio_write(tp, 0x06, 0xe802);
18792 rtl8168_mdio_write(tp, 0x06, 0x3a21);
18793 rtl8168_mdio_write(tp, 0x06, 0x0222);
18794 rtl8168_mdio_write(tp, 0x06, 0x10ae);
18795 rtl8168_mdio_write(tp, 0x06, 0x0bac);
18796 rtl8168_mdio_write(tp, 0x06, 0x3802);
18797 rtl8168_mdio_write(tp, 0x06, 0xae06);
18798 rtl8168_mdio_write(tp, 0x06, 0x0222);
18799 rtl8168_mdio_write(tp, 0x06, 0x4d02);
18800 rtl8168_mdio_write(tp, 0x06, 0x2292);
18801 rtl8168_mdio_write(tp, 0x06, 0x021b);
18802 rtl8168_mdio_write(tp, 0x06, 0x13fd);
18803 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18804 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
18805 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18806 rtl8168_mdio_write(tp, 0x06, 0xad20);
18807 rtl8168_mdio_write(tp, 0x06, 0x1af6);
18808 rtl8168_mdio_write(tp, 0x06, 0x20e4);
18809 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18810 rtl8168_mdio_write(tp, 0x06, 0x022b);
18811 rtl8168_mdio_write(tp, 0x06, 0x1e02);
18812 rtl8168_mdio_write(tp, 0x06, 0x82ae);
18813 rtl8168_mdio_write(tp, 0x06, 0x0203);
18814 rtl8168_mdio_write(tp, 0x06, 0xc002);
18815 rtl8168_mdio_write(tp, 0x06, 0x827d);
18816 rtl8168_mdio_write(tp, 0x06, 0x022e);
18817 rtl8168_mdio_write(tp, 0x06, 0x6f02);
18818 rtl8168_mdio_write(tp, 0x06, 0x047b);
18819 rtl8168_mdio_write(tp, 0x06, 0x022f);
18820 rtl8168_mdio_write(tp, 0x06, 0x9ae0);
18821 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18822 rtl8168_mdio_write(tp, 0x06, 0xad21);
18823 rtl8168_mdio_write(tp, 0x06, 0x0bf6);
18824 rtl8168_mdio_write(tp, 0x06, 0x21e4);
18825 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18826 rtl8168_mdio_write(tp, 0x06, 0x0281);
18827 rtl8168_mdio_write(tp, 0x06, 0x9002);
18828 rtl8168_mdio_write(tp, 0x06, 0x1cd9);
18829 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18830 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18831 rtl8168_mdio_write(tp, 0x06, 0x2208);
18832 rtl8168_mdio_write(tp, 0x06, 0xf622);
18833 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18834 rtl8168_mdio_write(tp, 0x06, 0x8e02);
18835 rtl8168_mdio_write(tp, 0x06, 0x35f4);
18836 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18837 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18838 rtl8168_mdio_write(tp, 0x06, 0x2308);
18839 rtl8168_mdio_write(tp, 0x06, 0xf623);
18840 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18841 rtl8168_mdio_write(tp, 0x06, 0x8e02);
18842 rtl8168_mdio_write(tp, 0x06, 0x31e8);
18843 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18844 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18845 rtl8168_mdio_write(tp, 0x06, 0x2405);
18846 rtl8168_mdio_write(tp, 0x06, 0xf624);
18847 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18848 rtl8168_mdio_write(tp, 0x06, 0x8ee0);
18849 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18850 rtl8168_mdio_write(tp, 0x06, 0xad25);
18851 rtl8168_mdio_write(tp, 0x06, 0x05f6);
18852 rtl8168_mdio_write(tp, 0x06, 0x25e4);
18853 rtl8168_mdio_write(tp, 0x06, 0x8b8e);
18854 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18855 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18856 rtl8168_mdio_write(tp, 0x06, 0x2608);
18857 rtl8168_mdio_write(tp, 0x06, 0xf626);
18858 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18859 rtl8168_mdio_write(tp, 0x06, 0x8e02);
18860 rtl8168_mdio_write(tp, 0x06, 0x2d8a);
18861 rtl8168_mdio_write(tp, 0x06, 0xe08b);
18862 rtl8168_mdio_write(tp, 0x06, 0x8ead);
18863 rtl8168_mdio_write(tp, 0x06, 0x2705);
18864 rtl8168_mdio_write(tp, 0x06, 0xf627);
18865 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18866 rtl8168_mdio_write(tp, 0x06, 0x8e02);
18867 rtl8168_mdio_write(tp, 0x06, 0x0386);
18868 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18869 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
18870 rtl8168_mdio_write(tp, 0x06, 0xef69);
18871 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
18872 rtl8168_mdio_write(tp, 0x06, 0x00e1);
18873 rtl8168_mdio_write(tp, 0x06, 0xe001);
18874 rtl8168_mdio_write(tp, 0x06, 0xad27);
18875 rtl8168_mdio_write(tp, 0x06, 0x32e0);
18876 rtl8168_mdio_write(tp, 0x06, 0x8b40);
18877 rtl8168_mdio_write(tp, 0x06, 0xf720);
18878 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18879 rtl8168_mdio_write(tp, 0x06, 0x40bf);
18880 rtl8168_mdio_write(tp, 0x06, 0x32c1);
18881 rtl8168_mdio_write(tp, 0x06, 0x0239);
18882 rtl8168_mdio_write(tp, 0x06, 0xf4ad);
18883 rtl8168_mdio_write(tp, 0x06, 0x2821);
18884 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
18885 rtl8168_mdio_write(tp, 0x06, 0x20e1);
18886 rtl8168_mdio_write(tp, 0x06, 0xe021);
18887 rtl8168_mdio_write(tp, 0x06, 0xad20);
18888 rtl8168_mdio_write(tp, 0x06, 0x18e0);
18889 rtl8168_mdio_write(tp, 0x06, 0x8b40);
18890 rtl8168_mdio_write(tp, 0x06, 0xf620);
18891 rtl8168_mdio_write(tp, 0x06, 0xe48b);
18892 rtl8168_mdio_write(tp, 0x06, 0x40ee);
18893 rtl8168_mdio_write(tp, 0x06, 0x8b3b);
18894 rtl8168_mdio_write(tp, 0x06, 0xffe0);
18895 rtl8168_mdio_write(tp, 0x06, 0x8a8a);
18896 rtl8168_mdio_write(tp, 0x06, 0xe18a);
18897 rtl8168_mdio_write(tp, 0x06, 0x8be4);
18898 rtl8168_mdio_write(tp, 0x06, 0xe000);
18899 rtl8168_mdio_write(tp, 0x06, 0xe5e0);
18900 rtl8168_mdio_write(tp, 0x06, 0x01ef);
18901 rtl8168_mdio_write(tp, 0x06, 0x96fe);
18902 rtl8168_mdio_write(tp, 0x06, 0xfc04);
18903 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
18904 rtl8168_mdio_write(tp, 0x06, 0xface);
18905 rtl8168_mdio_write(tp, 0x06, 0xfaef);
18906 rtl8168_mdio_write(tp, 0x06, 0x69fa);
18907 rtl8168_mdio_write(tp, 0x06, 0xd401);
18908 rtl8168_mdio_write(tp, 0x06, 0x55b4);
18909 rtl8168_mdio_write(tp, 0x06, 0xfebf);
18910 rtl8168_mdio_write(tp, 0x06, 0x1c5e);
18911 rtl8168_mdio_write(tp, 0x06, 0x0239);
18912 rtl8168_mdio_write(tp, 0x06, 0xf4ac);
18913 rtl8168_mdio_write(tp, 0x06, 0x280b);
18914 rtl8168_mdio_write(tp, 0x06, 0xbf1c);
18915 rtl8168_mdio_write(tp, 0x06, 0x5b02);
18916 rtl8168_mdio_write(tp, 0x06, 0x39f4);
18917 rtl8168_mdio_write(tp, 0x06, 0xac28);
18918 rtl8168_mdio_write(tp, 0x06, 0x49ae);
18919 rtl8168_mdio_write(tp, 0x06, 0x64bf);
18920 rtl8168_mdio_write(tp, 0x06, 0x1c5b);
18921 rtl8168_mdio_write(tp, 0x06, 0x0239);
18922 rtl8168_mdio_write(tp, 0x06, 0xf4ac);
18923 rtl8168_mdio_write(tp, 0x06, 0x285b);
18924 rtl8168_mdio_write(tp, 0x06, 0xd000);
18925 rtl8168_mdio_write(tp, 0x06, 0x0282);
18926 rtl8168_mdio_write(tp, 0x06, 0x62ac);
18927 rtl8168_mdio_write(tp, 0x06, 0x2105);
18928 rtl8168_mdio_write(tp, 0x06, 0xac22);
18929 rtl8168_mdio_write(tp, 0x06, 0x02ae);
18930 rtl8168_mdio_write(tp, 0x06, 0x4ebf);
18931 rtl8168_mdio_write(tp, 0x06, 0xe0c4);
18932 rtl8168_mdio_write(tp, 0x06, 0xbe85);
18933 rtl8168_mdio_write(tp, 0x06, 0xecd2);
18934 rtl8168_mdio_write(tp, 0x06, 0x04d8);
18935 rtl8168_mdio_write(tp, 0x06, 0x19d9);
18936 rtl8168_mdio_write(tp, 0x06, 0x1907);
18937 rtl8168_mdio_write(tp, 0x06, 0xdc19);
18938 rtl8168_mdio_write(tp, 0x06, 0xdd19);
18939 rtl8168_mdio_write(tp, 0x06, 0x0789);
18940 rtl8168_mdio_write(tp, 0x06, 0x89ef);
18941 rtl8168_mdio_write(tp, 0x06, 0x645e);
18942 rtl8168_mdio_write(tp, 0x06, 0x07ff);
18943 rtl8168_mdio_write(tp, 0x06, 0x0d65);
18944 rtl8168_mdio_write(tp, 0x06, 0x5cf8);
18945 rtl8168_mdio_write(tp, 0x06, 0x001e);
18946 rtl8168_mdio_write(tp, 0x06, 0x46dc);
18947 rtl8168_mdio_write(tp, 0x06, 0x19dd);
18948 rtl8168_mdio_write(tp, 0x06, 0x19b2);
18949 rtl8168_mdio_write(tp, 0x06, 0xe2d4);
18950 rtl8168_mdio_write(tp, 0x06, 0x0001);
18951 rtl8168_mdio_write(tp, 0x06, 0xbf1c);
18952 rtl8168_mdio_write(tp, 0x06, 0x5b02);
18953 rtl8168_mdio_write(tp, 0x06, 0x3a21);
18954 rtl8168_mdio_write(tp, 0x06, 0xae1d);
18955 rtl8168_mdio_write(tp, 0x06, 0xbee0);
18956 rtl8168_mdio_write(tp, 0x06, 0xc4bf);
18957 rtl8168_mdio_write(tp, 0x06, 0x85ec);
18958 rtl8168_mdio_write(tp, 0x06, 0xd204);
18959 rtl8168_mdio_write(tp, 0x06, 0xd819);
18960 rtl8168_mdio_write(tp, 0x06, 0xd919);
18961 rtl8168_mdio_write(tp, 0x06, 0x07dc);
18962 rtl8168_mdio_write(tp, 0x06, 0x19dd);
18963 rtl8168_mdio_write(tp, 0x06, 0x1907);
18964 rtl8168_mdio_write(tp, 0x06, 0xb2f4);
18965 rtl8168_mdio_write(tp, 0x06, 0xd400);
18966 rtl8168_mdio_write(tp, 0x06, 0x00bf);
18967 rtl8168_mdio_write(tp, 0x06, 0x1c5b);
18968 rtl8168_mdio_write(tp, 0x06, 0x023a);
18969 rtl8168_mdio_write(tp, 0x06, 0x21fe);
18970 rtl8168_mdio_write(tp, 0x06, 0xef96);
18971 rtl8168_mdio_write(tp, 0x06, 0xfec6);
18972 rtl8168_mdio_write(tp, 0x06, 0xfefd);
18973 rtl8168_mdio_write(tp, 0x06, 0xfc05);
18974 rtl8168_mdio_write(tp, 0x06, 0xf9e2);
18975 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
18976 rtl8168_mdio_write(tp, 0x06, 0xe3e0);
18977 rtl8168_mdio_write(tp, 0x06, 0xeb5a);
18978 rtl8168_mdio_write(tp, 0x06, 0x070c);
18979 rtl8168_mdio_write(tp, 0x06, 0x031e);
18980 rtl8168_mdio_write(tp, 0x06, 0x20e6);
18981 rtl8168_mdio_write(tp, 0x06, 0xe0ea);
18982 rtl8168_mdio_write(tp, 0x06, 0xe7e0);
18983 rtl8168_mdio_write(tp, 0x06, 0xebe0);
18984 rtl8168_mdio_write(tp, 0x06, 0xe0fc);
18985 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
18986 rtl8168_mdio_write(tp, 0x06, 0xfdfd);
18987 rtl8168_mdio_write(tp, 0x06, 0x04f8);
18988 rtl8168_mdio_write(tp, 0x06, 0xfaef);
18989 rtl8168_mdio_write(tp, 0x06, 0x69e0);
18990 rtl8168_mdio_write(tp, 0x06, 0x8b80);
18991 rtl8168_mdio_write(tp, 0x06, 0xad27);
18992 rtl8168_mdio_write(tp, 0x06, 0x22bf);
18993 rtl8168_mdio_write(tp, 0x06, 0x47ba);
18994 rtl8168_mdio_write(tp, 0x06, 0x0239);
18995 rtl8168_mdio_write(tp, 0x06, 0xf4e0);
18996 rtl8168_mdio_write(tp, 0x06, 0x8b44);
18997 rtl8168_mdio_write(tp, 0x06, 0x1f01);
18998 rtl8168_mdio_write(tp, 0x06, 0x9e15);
18999 rtl8168_mdio_write(tp, 0x06, 0xe58b);
19000 rtl8168_mdio_write(tp, 0x06, 0x44ad);
19001 rtl8168_mdio_write(tp, 0x06, 0x2907);
19002 rtl8168_mdio_write(tp, 0x06, 0xac28);
19003 rtl8168_mdio_write(tp, 0x06, 0x04d1);
19004 rtl8168_mdio_write(tp, 0x06, 0x01ae);
19005 rtl8168_mdio_write(tp, 0x06, 0x02d1);
19006 rtl8168_mdio_write(tp, 0x06, 0x00bf);
19007 rtl8168_mdio_write(tp, 0x06, 0x8342);
19008 rtl8168_mdio_write(tp, 0x06, 0x023a);
19009 rtl8168_mdio_write(tp, 0x06, 0x21ef);
19010 rtl8168_mdio_write(tp, 0x06, 0x96fe);
19011 rtl8168_mdio_write(tp, 0x06, 0xfc04);
19012 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
19013 rtl8168_mdio_write(tp, 0x06, 0x8b85);
19014 rtl8168_mdio_write(tp, 0x06, 0xad26);
19015 rtl8168_mdio_write(tp, 0x06, 0x30e0);
19016 rtl8168_mdio_write(tp, 0x06, 0xe036);
19017 rtl8168_mdio_write(tp, 0x06, 0xe1e0);
19018 rtl8168_mdio_write(tp, 0x06, 0x37e1);
19019 rtl8168_mdio_write(tp, 0x06, 0x8b3f);
19020 rtl8168_mdio_write(tp, 0x06, 0x1f10);
19021 rtl8168_mdio_write(tp, 0x06, 0x9e23);
19022 rtl8168_mdio_write(tp, 0x06, 0xe48b);
19023 rtl8168_mdio_write(tp, 0x06, 0x3fac);
19024 rtl8168_mdio_write(tp, 0x06, 0x200b);
19025 rtl8168_mdio_write(tp, 0x06, 0xac21);
19026 rtl8168_mdio_write(tp, 0x06, 0x0dac);
19027 rtl8168_mdio_write(tp, 0x06, 0x250f);
19028 rtl8168_mdio_write(tp, 0x06, 0xac27);
19029 rtl8168_mdio_write(tp, 0x06, 0x11ae);
19030 rtl8168_mdio_write(tp, 0x06, 0x1202);
19031 rtl8168_mdio_write(tp, 0x06, 0x2cb5);
19032 rtl8168_mdio_write(tp, 0x06, 0xae0d);
19033 rtl8168_mdio_write(tp, 0x06, 0x0282);
19034 rtl8168_mdio_write(tp, 0x06, 0xe7ae);
19035 rtl8168_mdio_write(tp, 0x06, 0x0802);
19036 rtl8168_mdio_write(tp, 0x06, 0x2cd7);
19037 rtl8168_mdio_write(tp, 0x06, 0xae03);
19038 rtl8168_mdio_write(tp, 0x06, 0x022c);
19039 rtl8168_mdio_write(tp, 0x06, 0xeafc);
19040 rtl8168_mdio_write(tp, 0x06, 0x04f8);
19041 rtl8168_mdio_write(tp, 0x06, 0xfaef);
19042 rtl8168_mdio_write(tp, 0x06, 0x6902);
19043 rtl8168_mdio_write(tp, 0x06, 0x8304);
19044 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
19045 rtl8168_mdio_write(tp, 0x06, 0x14e1);
19046 rtl8168_mdio_write(tp, 0x06, 0xe015);
19047 rtl8168_mdio_write(tp, 0x06, 0xad26);
19048 rtl8168_mdio_write(tp, 0x06, 0x08d1);
19049 rtl8168_mdio_write(tp, 0x06, 0x1ebf);
19050 rtl8168_mdio_write(tp, 0x06, 0x2d47);
19051 rtl8168_mdio_write(tp, 0x06, 0x023a);
19052 rtl8168_mdio_write(tp, 0x06, 0x21ef);
19053 rtl8168_mdio_write(tp, 0x06, 0x96fe);
19054 rtl8168_mdio_write(tp, 0x06, 0xfc04);
19055 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
19056 rtl8168_mdio_write(tp, 0x06, 0x8b85);
19057 rtl8168_mdio_write(tp, 0x06, 0xad27);
19058 rtl8168_mdio_write(tp, 0x06, 0x2fd0);
19059 rtl8168_mdio_write(tp, 0x06, 0x0b02);
19060 rtl8168_mdio_write(tp, 0x06, 0x3826);
19061 rtl8168_mdio_write(tp, 0x06, 0x5882);
19062 rtl8168_mdio_write(tp, 0x06, 0x7882);
19063 rtl8168_mdio_write(tp, 0x06, 0x9f24);
19064 rtl8168_mdio_write(tp, 0x06, 0xe08b);
19065 rtl8168_mdio_write(tp, 0x06, 0x32e1);
19066 rtl8168_mdio_write(tp, 0x06, 0x8b33);
19067 rtl8168_mdio_write(tp, 0x06, 0x1f10);
19068 rtl8168_mdio_write(tp, 0x06, 0x9e1a);
19069 rtl8168_mdio_write(tp, 0x06, 0x10e4);
19070 rtl8168_mdio_write(tp, 0x06, 0x8b32);
19071 rtl8168_mdio_write(tp, 0x06, 0xe0e0);
19072 rtl8168_mdio_write(tp, 0x06, 0x28e1);
19073 rtl8168_mdio_write(tp, 0x06, 0xe029);
19074 rtl8168_mdio_write(tp, 0x06, 0xf72c);
19075 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
19076 rtl8168_mdio_write(tp, 0x06, 0x28e5);
19077 rtl8168_mdio_write(tp, 0x06, 0xe029);
19078 rtl8168_mdio_write(tp, 0x06, 0xf62c);
19079 rtl8168_mdio_write(tp, 0x06, 0xe4e0);
19080 rtl8168_mdio_write(tp, 0x06, 0x28e5);
19081 rtl8168_mdio_write(tp, 0x06, 0xe029);
19082 rtl8168_mdio_write(tp, 0x06, 0xfc04);
19083 rtl8168_mdio_write(tp, 0x06, 0x00e1);
19084 rtl8168_mdio_write(tp, 0x06, 0x4077);
19085 rtl8168_mdio_write(tp, 0x06, 0xe140);
19086 rtl8168_mdio_write(tp, 0x06, 0xbbe0);
19087 rtl8168_mdio_write(tp, 0x06, 0x2a00);
19088 rtl8168_mdio_write(tp, 0x05, 0xe142);
19089 gphy_val = rtl8168_mdio_read(tp, 0x06);
19090 gphy_val |= BIT_0;
19091 rtl8168_mdio_write(tp,0x06, gphy_val);
19092 rtl8168_mdio_write(tp, 0x05, 0xe140);
19093 gphy_val = rtl8168_mdio_read(tp, 0x06);
19094 gphy_val |= BIT_0;
19095 rtl8168_mdio_write(tp,0x06, gphy_val);
19096 rtl8168_mdio_write(tp, 0x1f, 0x0000);
19097 rtl8168_mdio_write(tp,0x1f, 0x0005);
19098 for (i = 0; i < 200; i++) {
19099 udelay(100);
19100 gphy_val = rtl8168_mdio_read(tp, 0x00);
19101 if (gphy_val & BIT_7)
19102 break;
19103 }
19104 rtl8168_mdio_write(tp,0x1f, 0x0007);
19105 rtl8168_mdio_write(tp,0x1e, 0x0023);
19106 gphy_val = rtl8168_mdio_read(tp, 0x17);
19107 gphy_val |= BIT_1;
19108 if (tp->RequiredSecLanDonglePatch)
19109 gphy_val &= ~BIT_2;
19110 rtl8168_mdio_write(tp,0x17, gphy_val);
19111 rtl8168_mdio_write(tp,0x1f, 0x0000);
19112
19113 rtl8168_mdio_write(tp, 0x1F, 0x0003);
19114 rtl8168_mdio_write(tp, 0x09, 0xA20F);
19115 rtl8168_mdio_write(tp, 0x1F, 0x0000);
19116 rtl8168_mdio_write(tp, 0x1f, 0x0003);
19117 rtl8168_mdio_write(tp, 0x01, 0x328A);
19118 rtl8168_mdio_write(tp, 0x1f, 0x0000);
19119
19120 rtl8168_mdio_write(tp,0x1f, 0x0000);
19121 rtl8168_mdio_write(tp,0x00, 0x9200);
19122 }
19123
19124 static void
rtl8168_set_phy_mcu_8168g_1(struct net_device * dev)19125 rtl8168_set_phy_mcu_8168g_1(struct net_device *dev)
19126 {
19127 struct rtl8168_private *tp = netdev_priv(dev);
19128 unsigned int gphy_val;
19129
19130 rtl8168_set_phy_mcu_patch_request(tp);
19131 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
19132 rtl8168_mdio_write(tp, 0x13, 0x8146);
19133 rtl8168_mdio_write(tp, 0x14, 0x2300);
19134 rtl8168_mdio_write(tp, 0x13, 0xB820);
19135 rtl8168_mdio_write(tp, 0x14, 0x0210);
19136
19137 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
19138 rtl8168_mdio_write(tp, 0x13, 0xB820);
19139 rtl8168_mdio_write(tp, 0x14, 0x0290);
19140 rtl8168_mdio_write(tp, 0x13, 0xA012);
19141 rtl8168_mdio_write(tp, 0x14, 0x0000);
19142 rtl8168_mdio_write(tp, 0x13, 0xA014);
19143 rtl8168_mdio_write(tp, 0x14, 0x2c04);
19144 rtl8168_mdio_write(tp, 0x14, 0x2c0c);
19145 rtl8168_mdio_write(tp, 0x14, 0x2c6c);
19146 rtl8168_mdio_write(tp, 0x14, 0x2d0d);
19147 rtl8168_mdio_write(tp, 0x14, 0x31ce);
19148 rtl8168_mdio_write(tp, 0x14, 0x506d);
19149 rtl8168_mdio_write(tp, 0x14, 0xd708);
19150 rtl8168_mdio_write(tp, 0x14, 0x3108);
19151 rtl8168_mdio_write(tp, 0x14, 0x106d);
19152 rtl8168_mdio_write(tp, 0x14, 0x1560);
19153 rtl8168_mdio_write(tp, 0x14, 0x15a9);
19154 rtl8168_mdio_write(tp, 0x14, 0x206e);
19155 rtl8168_mdio_write(tp, 0x14, 0x175b);
19156 rtl8168_mdio_write(tp, 0x14, 0x6062);
19157 rtl8168_mdio_write(tp, 0x14, 0xd700);
19158 rtl8168_mdio_write(tp, 0x14, 0x5fae);
19159 rtl8168_mdio_write(tp, 0x14, 0xd708);
19160 rtl8168_mdio_write(tp, 0x14, 0x3107);
19161 rtl8168_mdio_write(tp, 0x14, 0x4c1e);
19162 rtl8168_mdio_write(tp, 0x14, 0x4169);
19163 rtl8168_mdio_write(tp, 0x14, 0x316a);
19164 rtl8168_mdio_write(tp, 0x14, 0x0c19);
19165 rtl8168_mdio_write(tp, 0x14, 0x31aa);
19166 rtl8168_mdio_write(tp, 0x14, 0x0c19);
19167 rtl8168_mdio_write(tp, 0x14, 0x2c1b);
19168 rtl8168_mdio_write(tp, 0x14, 0x5e62);
19169 rtl8168_mdio_write(tp, 0x14, 0x26b5);
19170 rtl8168_mdio_write(tp, 0x14, 0x31ab);
19171 rtl8168_mdio_write(tp, 0x14, 0x5c1e);
19172 rtl8168_mdio_write(tp, 0x14, 0x2c0c);
19173 rtl8168_mdio_write(tp, 0x14, 0xc040);
19174 rtl8168_mdio_write(tp, 0x14, 0x8808);
19175 rtl8168_mdio_write(tp, 0x14, 0xc520);
19176 rtl8168_mdio_write(tp, 0x14, 0xc421);
19177 rtl8168_mdio_write(tp, 0x14, 0xd05a);
19178 rtl8168_mdio_write(tp, 0x14, 0xd19a);
19179 rtl8168_mdio_write(tp, 0x14, 0xd709);
19180 rtl8168_mdio_write(tp, 0x14, 0x608f);
19181 rtl8168_mdio_write(tp, 0x14, 0xd06b);
19182 rtl8168_mdio_write(tp, 0x14, 0xd18a);
19183 rtl8168_mdio_write(tp, 0x14, 0x2c2c);
19184 rtl8168_mdio_write(tp, 0x14, 0xd0be);
19185 rtl8168_mdio_write(tp, 0x14, 0xd188);
19186 rtl8168_mdio_write(tp, 0x14, 0x2c2c);
19187 rtl8168_mdio_write(tp, 0x14, 0xd708);
19188 rtl8168_mdio_write(tp, 0x14, 0x4072);
19189 rtl8168_mdio_write(tp, 0x14, 0xc104);
19190 rtl8168_mdio_write(tp, 0x14, 0x2c3e);
19191 rtl8168_mdio_write(tp, 0x14, 0x4076);
19192 rtl8168_mdio_write(tp, 0x14, 0xc110);
19193 rtl8168_mdio_write(tp, 0x14, 0x2c3e);
19194 rtl8168_mdio_write(tp, 0x14, 0x4071);
19195 rtl8168_mdio_write(tp, 0x14, 0xc102);
19196 rtl8168_mdio_write(tp, 0x14, 0x2c3e);
19197 rtl8168_mdio_write(tp, 0x14, 0x4070);
19198 rtl8168_mdio_write(tp, 0x14, 0xc101);
19199 rtl8168_mdio_write(tp, 0x14, 0x2c3e);
19200 rtl8168_mdio_write(tp, 0x14, 0x175b);
19201 rtl8168_mdio_write(tp, 0x14, 0xd709);
19202 rtl8168_mdio_write(tp, 0x14, 0x3390);
19203 rtl8168_mdio_write(tp, 0x14, 0x5c39);
19204 rtl8168_mdio_write(tp, 0x14, 0x2c4e);
19205 rtl8168_mdio_write(tp, 0x14, 0x175b);
19206 rtl8168_mdio_write(tp, 0x14, 0xd708);
19207 rtl8168_mdio_write(tp, 0x14, 0x6193);
19208 rtl8168_mdio_write(tp, 0x14, 0xd709);
19209 rtl8168_mdio_write(tp, 0x14, 0x5f9d);
19210 rtl8168_mdio_write(tp, 0x14, 0x408b);
19211 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19212 rtl8168_mdio_write(tp, 0x14, 0x6042);
19213 rtl8168_mdio_write(tp, 0x14, 0xb401);
19214 rtl8168_mdio_write(tp, 0x14, 0x175b);
19215 rtl8168_mdio_write(tp, 0x14, 0xd708);
19216 rtl8168_mdio_write(tp, 0x14, 0x6073);
19217 rtl8168_mdio_write(tp, 0x14, 0x5fbc);
19218 rtl8168_mdio_write(tp, 0x14, 0x2c4d);
19219 rtl8168_mdio_write(tp, 0x14, 0x26ed);
19220 rtl8168_mdio_write(tp, 0x14, 0xb280);
19221 rtl8168_mdio_write(tp, 0x14, 0xa841);
19222 rtl8168_mdio_write(tp, 0x14, 0x9420);
19223 rtl8168_mdio_write(tp, 0x14, 0x8710);
19224 rtl8168_mdio_write(tp, 0x14, 0xd709);
19225 rtl8168_mdio_write(tp, 0x14, 0x42ec);
19226 rtl8168_mdio_write(tp, 0x14, 0x606d);
19227 rtl8168_mdio_write(tp, 0x14, 0xd207);
19228 rtl8168_mdio_write(tp, 0x14, 0x2c57);
19229 rtl8168_mdio_write(tp, 0x14, 0xd203);
19230 rtl8168_mdio_write(tp, 0x14, 0x33ff);
19231 rtl8168_mdio_write(tp, 0x14, 0x563b);
19232 rtl8168_mdio_write(tp, 0x14, 0x3275);
19233 rtl8168_mdio_write(tp, 0x14, 0x7c5e);
19234 rtl8168_mdio_write(tp, 0x14, 0xb240);
19235 rtl8168_mdio_write(tp, 0x14, 0xb402);
19236 rtl8168_mdio_write(tp, 0x14, 0x263b);
19237 rtl8168_mdio_write(tp, 0x14, 0x6096);
19238 rtl8168_mdio_write(tp, 0x14, 0xb240);
19239 rtl8168_mdio_write(tp, 0x14, 0xb406);
19240 rtl8168_mdio_write(tp, 0x14, 0x263b);
19241 rtl8168_mdio_write(tp, 0x14, 0x31d7);
19242 rtl8168_mdio_write(tp, 0x14, 0x7c67);
19243 rtl8168_mdio_write(tp, 0x14, 0xb240);
19244 rtl8168_mdio_write(tp, 0x14, 0xb40e);
19245 rtl8168_mdio_write(tp, 0x14, 0x263b);
19246 rtl8168_mdio_write(tp, 0x14, 0xb410);
19247 rtl8168_mdio_write(tp, 0x14, 0x8802);
19248 rtl8168_mdio_write(tp, 0x14, 0xb240);
19249 rtl8168_mdio_write(tp, 0x14, 0x940e);
19250 rtl8168_mdio_write(tp, 0x14, 0x263b);
19251 rtl8168_mdio_write(tp, 0x14, 0xba04);
19252 rtl8168_mdio_write(tp, 0x14, 0x1cd6);
19253 rtl8168_mdio_write(tp, 0x14, 0xa902);
19254 rtl8168_mdio_write(tp, 0x14, 0xd711);
19255 rtl8168_mdio_write(tp, 0x14, 0x4045);
19256 rtl8168_mdio_write(tp, 0x14, 0xa980);
19257 rtl8168_mdio_write(tp, 0x14, 0x3003);
19258 rtl8168_mdio_write(tp, 0x14, 0x59b1);
19259 rtl8168_mdio_write(tp, 0x14, 0xa540);
19260 rtl8168_mdio_write(tp, 0x14, 0xa601);
19261 rtl8168_mdio_write(tp, 0x14, 0xd710);
19262 rtl8168_mdio_write(tp, 0x14, 0x4043);
19263 rtl8168_mdio_write(tp, 0x14, 0xa910);
19264 rtl8168_mdio_write(tp, 0x14, 0xd711);
19265 rtl8168_mdio_write(tp, 0x14, 0x60a0);
19266 rtl8168_mdio_write(tp, 0x14, 0xca33);
19267 rtl8168_mdio_write(tp, 0x14, 0xcb33);
19268 rtl8168_mdio_write(tp, 0x14, 0xa941);
19269 rtl8168_mdio_write(tp, 0x14, 0x2c82);
19270 rtl8168_mdio_write(tp, 0x14, 0xcaff);
19271 rtl8168_mdio_write(tp, 0x14, 0xcbff);
19272 rtl8168_mdio_write(tp, 0x14, 0xa921);
19273 rtl8168_mdio_write(tp, 0x14, 0xce02);
19274 rtl8168_mdio_write(tp, 0x14, 0xe070);
19275 rtl8168_mdio_write(tp, 0x14, 0x0f10);
19276 rtl8168_mdio_write(tp, 0x14, 0xaf01);
19277 rtl8168_mdio_write(tp, 0x14, 0x8f01);
19278 rtl8168_mdio_write(tp, 0x14, 0x1766);
19279 rtl8168_mdio_write(tp, 0x14, 0x8e02);
19280 rtl8168_mdio_write(tp, 0x14, 0x1787);
19281 rtl8168_mdio_write(tp, 0x14, 0xd710);
19282 rtl8168_mdio_write(tp, 0x14, 0x609c);
19283 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19284 rtl8168_mdio_write(tp, 0x14, 0x7fa4);
19285 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19286 rtl8168_mdio_write(tp, 0x14, 0x1ce9);
19287 rtl8168_mdio_write(tp, 0x14, 0xce04);
19288 rtl8168_mdio_write(tp, 0x14, 0xe070);
19289 rtl8168_mdio_write(tp, 0x14, 0x0f20);
19290 rtl8168_mdio_write(tp, 0x14, 0xaf01);
19291 rtl8168_mdio_write(tp, 0x14, 0x8f01);
19292 rtl8168_mdio_write(tp, 0x14, 0x1766);
19293 rtl8168_mdio_write(tp, 0x14, 0x8e04);
19294 rtl8168_mdio_write(tp, 0x14, 0x6044);
19295 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19296 rtl8168_mdio_write(tp, 0x14, 0xa520);
19297 rtl8168_mdio_write(tp, 0x14, 0xd710);
19298 rtl8168_mdio_write(tp, 0x14, 0x4043);
19299 rtl8168_mdio_write(tp, 0x14, 0x2cc1);
19300 rtl8168_mdio_write(tp, 0x14, 0xe00f);
19301 rtl8168_mdio_write(tp, 0x14, 0x0501);
19302 rtl8168_mdio_write(tp, 0x14, 0x1cef);
19303 rtl8168_mdio_write(tp, 0x14, 0xb801);
19304 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19305 rtl8168_mdio_write(tp, 0x14, 0x4060);
19306 rtl8168_mdio_write(tp, 0x14, 0x7fc4);
19307 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19308 rtl8168_mdio_write(tp, 0x14, 0x1cf5);
19309 rtl8168_mdio_write(tp, 0x14, 0xe00f);
19310 rtl8168_mdio_write(tp, 0x14, 0x0502);
19311 rtl8168_mdio_write(tp, 0x14, 0x1cef);
19312 rtl8168_mdio_write(tp, 0x14, 0xb802);
19313 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19314 rtl8168_mdio_write(tp, 0x14, 0x4061);
19315 rtl8168_mdio_write(tp, 0x14, 0x7fc4);
19316 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19317 rtl8168_mdio_write(tp, 0x14, 0x1cf5);
19318 rtl8168_mdio_write(tp, 0x14, 0xe00f);
19319 rtl8168_mdio_write(tp, 0x14, 0x0504);
19320 rtl8168_mdio_write(tp, 0x14, 0xd710);
19321 rtl8168_mdio_write(tp, 0x14, 0x6099);
19322 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19323 rtl8168_mdio_write(tp, 0x14, 0x7fa4);
19324 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19325 rtl8168_mdio_write(tp, 0x14, 0xc17f);
19326 rtl8168_mdio_write(tp, 0x14, 0xc200);
19327 rtl8168_mdio_write(tp, 0x14, 0xc43f);
19328 rtl8168_mdio_write(tp, 0x14, 0xcc03);
19329 rtl8168_mdio_write(tp, 0x14, 0xa701);
19330 rtl8168_mdio_write(tp, 0x14, 0xa510);
19331 rtl8168_mdio_write(tp, 0x14, 0xd710);
19332 rtl8168_mdio_write(tp, 0x14, 0x4018);
19333 rtl8168_mdio_write(tp, 0x14, 0x9910);
19334 rtl8168_mdio_write(tp, 0x14, 0x8510);
19335 rtl8168_mdio_write(tp, 0x14, 0x2860);
19336 rtl8168_mdio_write(tp, 0x14, 0xe00f);
19337 rtl8168_mdio_write(tp, 0x14, 0x0504);
19338 rtl8168_mdio_write(tp, 0x14, 0xd710);
19339 rtl8168_mdio_write(tp, 0x14, 0x6099);
19340 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19341 rtl8168_mdio_write(tp, 0x14, 0x7fa4);
19342 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19343 rtl8168_mdio_write(tp, 0x14, 0xa608);
19344 rtl8168_mdio_write(tp, 0x14, 0xc17d);
19345 rtl8168_mdio_write(tp, 0x14, 0xc200);
19346 rtl8168_mdio_write(tp, 0x14, 0xc43f);
19347 rtl8168_mdio_write(tp, 0x14, 0xcc03);
19348 rtl8168_mdio_write(tp, 0x14, 0xa701);
19349 rtl8168_mdio_write(tp, 0x14, 0xa510);
19350 rtl8168_mdio_write(tp, 0x14, 0xd710);
19351 rtl8168_mdio_write(tp, 0x14, 0x4018);
19352 rtl8168_mdio_write(tp, 0x14, 0x9910);
19353 rtl8168_mdio_write(tp, 0x14, 0x8510);
19354 rtl8168_mdio_write(tp, 0x14, 0x2926);
19355 rtl8168_mdio_write(tp, 0x14, 0x1792);
19356 rtl8168_mdio_write(tp, 0x14, 0x27db);
19357 rtl8168_mdio_write(tp, 0x14, 0xc000);
19358 rtl8168_mdio_write(tp, 0x14, 0xc100);
19359 rtl8168_mdio_write(tp, 0x14, 0xc200);
19360 rtl8168_mdio_write(tp, 0x14, 0xc300);
19361 rtl8168_mdio_write(tp, 0x14, 0xc400);
19362 rtl8168_mdio_write(tp, 0x14, 0xc500);
19363 rtl8168_mdio_write(tp, 0x14, 0xc600);
19364 rtl8168_mdio_write(tp, 0x14, 0xc7c1);
19365 rtl8168_mdio_write(tp, 0x14, 0xc800);
19366 rtl8168_mdio_write(tp, 0x14, 0xcc00);
19367 rtl8168_mdio_write(tp, 0x14, 0x0800);
19368 rtl8168_mdio_write(tp, 0x14, 0xca0f);
19369 rtl8168_mdio_write(tp, 0x14, 0xcbff);
19370 rtl8168_mdio_write(tp, 0x14, 0xa901);
19371 rtl8168_mdio_write(tp, 0x14, 0x8902);
19372 rtl8168_mdio_write(tp, 0x14, 0xc900);
19373 rtl8168_mdio_write(tp, 0x14, 0xca00);
19374 rtl8168_mdio_write(tp, 0x14, 0xcb00);
19375 rtl8168_mdio_write(tp, 0x14, 0x0800);
19376 rtl8168_mdio_write(tp, 0x14, 0xb804);
19377 rtl8168_mdio_write(tp, 0x14, 0x0800);
19378 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19379 rtl8168_mdio_write(tp, 0x14, 0x6044);
19380 rtl8168_mdio_write(tp, 0x14, 0x9804);
19381 rtl8168_mdio_write(tp, 0x14, 0x0800);
19382 rtl8168_mdio_write(tp, 0x14, 0xd710);
19383 rtl8168_mdio_write(tp, 0x14, 0x6099);
19384 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19385 rtl8168_mdio_write(tp, 0x14, 0x7fa4);
19386 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19387 rtl8168_mdio_write(tp, 0x14, 0x0800);
19388 rtl8168_mdio_write(tp, 0x14, 0xa510);
19389 rtl8168_mdio_write(tp, 0x14, 0xd710);
19390 rtl8168_mdio_write(tp, 0x14, 0x6098);
19391 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19392 rtl8168_mdio_write(tp, 0x14, 0x7fa4);
19393 rtl8168_mdio_write(tp, 0x14, 0x2cd4);
19394 rtl8168_mdio_write(tp, 0x14, 0x8510);
19395 rtl8168_mdio_write(tp, 0x14, 0x0800);
19396 rtl8168_mdio_write(tp, 0x14, 0xd711);
19397 rtl8168_mdio_write(tp, 0x14, 0x3003);
19398 rtl8168_mdio_write(tp, 0x14, 0x1d01);
19399 rtl8168_mdio_write(tp, 0x14, 0x2d0b);
19400 rtl8168_mdio_write(tp, 0x14, 0xd710);
19401 rtl8168_mdio_write(tp, 0x14, 0x60be);
19402 rtl8168_mdio_write(tp, 0x14, 0xe060);
19403 rtl8168_mdio_write(tp, 0x14, 0x0920);
19404 rtl8168_mdio_write(tp, 0x14, 0x1cd6);
19405 rtl8168_mdio_write(tp, 0x14, 0x2c89);
19406 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19407 rtl8168_mdio_write(tp, 0x14, 0x3063);
19408 rtl8168_mdio_write(tp, 0x14, 0x1948);
19409 rtl8168_mdio_write(tp, 0x14, 0x288a);
19410 rtl8168_mdio_write(tp, 0x14, 0x1cd6);
19411 rtl8168_mdio_write(tp, 0x14, 0x29bd);
19412 rtl8168_mdio_write(tp, 0x14, 0xa802);
19413 rtl8168_mdio_write(tp, 0x14, 0xa303);
19414 rtl8168_mdio_write(tp, 0x14, 0x843f);
19415 rtl8168_mdio_write(tp, 0x14, 0x81ff);
19416 rtl8168_mdio_write(tp, 0x14, 0x8208);
19417 rtl8168_mdio_write(tp, 0x14, 0xa201);
19418 rtl8168_mdio_write(tp, 0x14, 0xc001);
19419 rtl8168_mdio_write(tp, 0x14, 0xd710);
19420 rtl8168_mdio_write(tp, 0x14, 0x30a0);
19421 rtl8168_mdio_write(tp, 0x14, 0x0d1c);
19422 rtl8168_mdio_write(tp, 0x14, 0x30a0);
19423 rtl8168_mdio_write(tp, 0x14, 0x3d13);
19424 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19425 rtl8168_mdio_write(tp, 0x14, 0x7f4c);
19426 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19427 rtl8168_mdio_write(tp, 0x14, 0xe003);
19428 rtl8168_mdio_write(tp, 0x14, 0x0202);
19429 rtl8168_mdio_write(tp, 0x14, 0xd710);
19430 rtl8168_mdio_write(tp, 0x14, 0x6090);
19431 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19432 rtl8168_mdio_write(tp, 0x14, 0x7fac);
19433 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19434 rtl8168_mdio_write(tp, 0x14, 0xa20c);
19435 rtl8168_mdio_write(tp, 0x14, 0xd710);
19436 rtl8168_mdio_write(tp, 0x14, 0x6091);
19437 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19438 rtl8168_mdio_write(tp, 0x14, 0x7fac);
19439 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19440 rtl8168_mdio_write(tp, 0x14, 0x820e);
19441 rtl8168_mdio_write(tp, 0x14, 0xa3e0);
19442 rtl8168_mdio_write(tp, 0x14, 0xa520);
19443 rtl8168_mdio_write(tp, 0x14, 0xd710);
19444 rtl8168_mdio_write(tp, 0x14, 0x609d);
19445 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19446 rtl8168_mdio_write(tp, 0x14, 0x7fac);
19447 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19448 rtl8168_mdio_write(tp, 0x14, 0x8520);
19449 rtl8168_mdio_write(tp, 0x14, 0x6703);
19450 rtl8168_mdio_write(tp, 0x14, 0x2d34);
19451 rtl8168_mdio_write(tp, 0x14, 0xa13e);
19452 rtl8168_mdio_write(tp, 0x14, 0xc001);
19453 rtl8168_mdio_write(tp, 0x14, 0xd710);
19454 rtl8168_mdio_write(tp, 0x14, 0x4000);
19455 rtl8168_mdio_write(tp, 0x14, 0x6046);
19456 rtl8168_mdio_write(tp, 0x14, 0x2d0d);
19457 rtl8168_mdio_write(tp, 0x14, 0xa43f);
19458 rtl8168_mdio_write(tp, 0x14, 0xa101);
19459 rtl8168_mdio_write(tp, 0x14, 0xc020);
19460 rtl8168_mdio_write(tp, 0x14, 0xd710);
19461 rtl8168_mdio_write(tp, 0x14, 0x3121);
19462 rtl8168_mdio_write(tp, 0x14, 0x0d45);
19463 rtl8168_mdio_write(tp, 0x14, 0x30c0);
19464 rtl8168_mdio_write(tp, 0x14, 0x3d0d);
19465 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19466 rtl8168_mdio_write(tp, 0x14, 0x7f4c);
19467 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19468 rtl8168_mdio_write(tp, 0x14, 0xa540);
19469 rtl8168_mdio_write(tp, 0x14, 0xc001);
19470 rtl8168_mdio_write(tp, 0x14, 0xd710);
19471 rtl8168_mdio_write(tp, 0x14, 0x4001);
19472 rtl8168_mdio_write(tp, 0x14, 0xe00f);
19473 rtl8168_mdio_write(tp, 0x14, 0x0501);
19474 rtl8168_mdio_write(tp, 0x14, 0x1dac);
19475 rtl8168_mdio_write(tp, 0x14, 0xc1c4);
19476 rtl8168_mdio_write(tp, 0x14, 0xa268);
19477 rtl8168_mdio_write(tp, 0x14, 0xa303);
19478 rtl8168_mdio_write(tp, 0x14, 0x8420);
19479 rtl8168_mdio_write(tp, 0x14, 0xe00f);
19480 rtl8168_mdio_write(tp, 0x14, 0x0502);
19481 rtl8168_mdio_write(tp, 0x14, 0x1dac);
19482 rtl8168_mdio_write(tp, 0x14, 0xc002);
19483 rtl8168_mdio_write(tp, 0x14, 0xd710);
19484 rtl8168_mdio_write(tp, 0x14, 0x4000);
19485 rtl8168_mdio_write(tp, 0x14, 0x8208);
19486 rtl8168_mdio_write(tp, 0x14, 0x8410);
19487 rtl8168_mdio_write(tp, 0x14, 0xa121);
19488 rtl8168_mdio_write(tp, 0x14, 0xc002);
19489 rtl8168_mdio_write(tp, 0x14, 0xd710);
19490 rtl8168_mdio_write(tp, 0x14, 0x4000);
19491 rtl8168_mdio_write(tp, 0x14, 0x8120);
19492 rtl8168_mdio_write(tp, 0x14, 0x8180);
19493 rtl8168_mdio_write(tp, 0x14, 0x1d97);
19494 rtl8168_mdio_write(tp, 0x14, 0xa180);
19495 rtl8168_mdio_write(tp, 0x14, 0xa13a);
19496 rtl8168_mdio_write(tp, 0x14, 0x8240);
19497 rtl8168_mdio_write(tp, 0x14, 0xa430);
19498 rtl8168_mdio_write(tp, 0x14, 0xc010);
19499 rtl8168_mdio_write(tp, 0x14, 0xd710);
19500 rtl8168_mdio_write(tp, 0x14, 0x30e1);
19501 rtl8168_mdio_write(tp, 0x14, 0x0abc);
19502 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19503 rtl8168_mdio_write(tp, 0x14, 0x7f8c);
19504 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19505 rtl8168_mdio_write(tp, 0x14, 0xa480);
19506 rtl8168_mdio_write(tp, 0x14, 0xa230);
19507 rtl8168_mdio_write(tp, 0x14, 0xa303);
19508 rtl8168_mdio_write(tp, 0x14, 0xc001);
19509 rtl8168_mdio_write(tp, 0x14, 0xd70c);
19510 rtl8168_mdio_write(tp, 0x14, 0x4124);
19511 rtl8168_mdio_write(tp, 0x14, 0xd710);
19512 rtl8168_mdio_write(tp, 0x14, 0x6120);
19513 rtl8168_mdio_write(tp, 0x14, 0xd711);
19514 rtl8168_mdio_write(tp, 0x14, 0x3128);
19515 rtl8168_mdio_write(tp, 0x14, 0x3d76);
19516 rtl8168_mdio_write(tp, 0x14, 0x2d70);
19517 rtl8168_mdio_write(tp, 0x14, 0xa801);
19518 rtl8168_mdio_write(tp, 0x14, 0x2d6c);
19519 rtl8168_mdio_write(tp, 0x14, 0xd710);
19520 rtl8168_mdio_write(tp, 0x14, 0x4000);
19521 rtl8168_mdio_write(tp, 0x14, 0xe018);
19522 rtl8168_mdio_write(tp, 0x14, 0x0208);
19523 rtl8168_mdio_write(tp, 0x14, 0xa1f8);
19524 rtl8168_mdio_write(tp, 0x14, 0x8480);
19525 rtl8168_mdio_write(tp, 0x14, 0xc004);
19526 rtl8168_mdio_write(tp, 0x14, 0xd710);
19527 rtl8168_mdio_write(tp, 0x14, 0x4000);
19528 rtl8168_mdio_write(tp, 0x14, 0x6046);
19529 rtl8168_mdio_write(tp, 0x14, 0x2d0d);
19530 rtl8168_mdio_write(tp, 0x14, 0xa43f);
19531 rtl8168_mdio_write(tp, 0x14, 0xa105);
19532 rtl8168_mdio_write(tp, 0x14, 0x8228);
19533 rtl8168_mdio_write(tp, 0x14, 0xc004);
19534 rtl8168_mdio_write(tp, 0x14, 0xd710);
19535 rtl8168_mdio_write(tp, 0x14, 0x4000);
19536 rtl8168_mdio_write(tp, 0x14, 0x81bc);
19537 rtl8168_mdio_write(tp, 0x14, 0xa220);
19538 rtl8168_mdio_write(tp, 0x14, 0x1d97);
19539 rtl8168_mdio_write(tp, 0x14, 0x8220);
19540 rtl8168_mdio_write(tp, 0x14, 0xa1bc);
19541 rtl8168_mdio_write(tp, 0x14, 0xc040);
19542 rtl8168_mdio_write(tp, 0x14, 0xd710);
19543 rtl8168_mdio_write(tp, 0x14, 0x30e1);
19544 rtl8168_mdio_write(tp, 0x14, 0x0abc);
19545 rtl8168_mdio_write(tp, 0x14, 0x30e1);
19546 rtl8168_mdio_write(tp, 0x14, 0x3d0d);
19547 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19548 rtl8168_mdio_write(tp, 0x14, 0x7f4c);
19549 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19550 rtl8168_mdio_write(tp, 0x14, 0xa802);
19551 rtl8168_mdio_write(tp, 0x14, 0xd70c);
19552 rtl8168_mdio_write(tp, 0x14, 0x4244);
19553 rtl8168_mdio_write(tp, 0x14, 0xa301);
19554 rtl8168_mdio_write(tp, 0x14, 0xc004);
19555 rtl8168_mdio_write(tp, 0x14, 0xd711);
19556 rtl8168_mdio_write(tp, 0x14, 0x3128);
19557 rtl8168_mdio_write(tp, 0x14, 0x3da5);
19558 rtl8168_mdio_write(tp, 0x14, 0xd710);
19559 rtl8168_mdio_write(tp, 0x14, 0x5f80);
19560 rtl8168_mdio_write(tp, 0x14, 0xd711);
19561 rtl8168_mdio_write(tp, 0x14, 0x3109);
19562 rtl8168_mdio_write(tp, 0x14, 0x3da7);
19563 rtl8168_mdio_write(tp, 0x14, 0x2dab);
19564 rtl8168_mdio_write(tp, 0x14, 0xa801);
19565 rtl8168_mdio_write(tp, 0x14, 0x2d9a);
19566 rtl8168_mdio_write(tp, 0x14, 0xa802);
19567 rtl8168_mdio_write(tp, 0x14, 0xc004);
19568 rtl8168_mdio_write(tp, 0x14, 0xd710);
19569 rtl8168_mdio_write(tp, 0x14, 0x4000);
19570 rtl8168_mdio_write(tp, 0x14, 0x0800);
19571 rtl8168_mdio_write(tp, 0x14, 0xa510);
19572 rtl8168_mdio_write(tp, 0x14, 0xd710);
19573 rtl8168_mdio_write(tp, 0x14, 0x609a);
19574 rtl8168_mdio_write(tp, 0x14, 0xd71e);
19575 rtl8168_mdio_write(tp, 0x14, 0x7fac);
19576 rtl8168_mdio_write(tp, 0x14, 0x2ab6);
19577 rtl8168_mdio_write(tp, 0x14, 0x8510);
19578 rtl8168_mdio_write(tp, 0x14, 0x0800);
19579 rtl8168_mdio_write(tp, 0x13, 0xA01A);
19580 rtl8168_mdio_write(tp, 0x14, 0x0000);
19581 rtl8168_mdio_write(tp, 0x13, 0xA006);
19582 rtl8168_mdio_write(tp, 0x14, 0x0ad6);
19583 rtl8168_mdio_write(tp, 0x13, 0xA004);
19584 rtl8168_mdio_write(tp, 0x14, 0x07f5);
19585 rtl8168_mdio_write(tp, 0x13, 0xA002);
19586 rtl8168_mdio_write(tp, 0x14, 0x06a9);
19587 rtl8168_mdio_write(tp, 0x13, 0xA000);
19588 rtl8168_mdio_write(tp, 0x14, 0xf069);
19589 rtl8168_mdio_write(tp, 0x13, 0xB820);
19590 rtl8168_mdio_write(tp, 0x14, 0x0210);
19591
19592 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
19593 rtl8168_mdio_write(tp, 0x13, 0x83a0);
19594 rtl8168_mdio_write(tp, 0x14, 0xaf83);
19595 rtl8168_mdio_write(tp, 0x14, 0xacaf);
19596 rtl8168_mdio_write(tp, 0x14, 0x83b8);
19597 rtl8168_mdio_write(tp, 0x14, 0xaf83);
19598 rtl8168_mdio_write(tp, 0x14, 0xcdaf);
19599 rtl8168_mdio_write(tp, 0x14, 0x83d3);
19600 rtl8168_mdio_write(tp, 0x14, 0x0204);
19601 rtl8168_mdio_write(tp, 0x14, 0x9a02);
19602 rtl8168_mdio_write(tp, 0x14, 0x09a9);
19603 rtl8168_mdio_write(tp, 0x14, 0x0284);
19604 rtl8168_mdio_write(tp, 0x14, 0x61af);
19605 rtl8168_mdio_write(tp, 0x14, 0x02fc);
19606 rtl8168_mdio_write(tp, 0x14, 0xad20);
19607 rtl8168_mdio_write(tp, 0x14, 0x0302);
19608 rtl8168_mdio_write(tp, 0x14, 0x867c);
19609 rtl8168_mdio_write(tp, 0x14, 0xad21);
19610 rtl8168_mdio_write(tp, 0x14, 0x0302);
19611 rtl8168_mdio_write(tp, 0x14, 0x85c9);
19612 rtl8168_mdio_write(tp, 0x14, 0xad22);
19613 rtl8168_mdio_write(tp, 0x14, 0x0302);
19614 rtl8168_mdio_write(tp, 0x14, 0x1bc0);
19615 rtl8168_mdio_write(tp, 0x14, 0xaf17);
19616 rtl8168_mdio_write(tp, 0x14, 0xe302);
19617 rtl8168_mdio_write(tp, 0x14, 0x8703);
19618 rtl8168_mdio_write(tp, 0x14, 0xaf18);
19619 rtl8168_mdio_write(tp, 0x14, 0x6201);
19620 rtl8168_mdio_write(tp, 0x14, 0x06e0);
19621 rtl8168_mdio_write(tp, 0x14, 0x8148);
19622 rtl8168_mdio_write(tp, 0x14, 0xaf3c);
19623 rtl8168_mdio_write(tp, 0x14, 0x69f8);
19624 rtl8168_mdio_write(tp, 0x14, 0xf9fa);
19625 rtl8168_mdio_write(tp, 0x14, 0xef69);
19626 rtl8168_mdio_write(tp, 0x14, 0xee80);
19627 rtl8168_mdio_write(tp, 0x14, 0x10f7);
19628 rtl8168_mdio_write(tp, 0x14, 0xee80);
19629 rtl8168_mdio_write(tp, 0x14, 0x131f);
19630 rtl8168_mdio_write(tp, 0x14, 0xd104);
19631 rtl8168_mdio_write(tp, 0x14, 0xbf87);
19632 rtl8168_mdio_write(tp, 0x14, 0xf302);
19633 rtl8168_mdio_write(tp, 0x14, 0x4259);
19634 rtl8168_mdio_write(tp, 0x14, 0x0287);
19635 rtl8168_mdio_write(tp, 0x14, 0x88bf);
19636 rtl8168_mdio_write(tp, 0x14, 0x87cf);
19637 rtl8168_mdio_write(tp, 0x14, 0xd7b8);
19638 rtl8168_mdio_write(tp, 0x14, 0x22d0);
19639 rtl8168_mdio_write(tp, 0x14, 0x0c02);
19640 rtl8168_mdio_write(tp, 0x14, 0x4252);
19641 rtl8168_mdio_write(tp, 0x14, 0xee80);
19642 rtl8168_mdio_write(tp, 0x14, 0xcda0);
19643 rtl8168_mdio_write(tp, 0x14, 0xee80);
19644 rtl8168_mdio_write(tp, 0x14, 0xce8b);
19645 rtl8168_mdio_write(tp, 0x14, 0xee80);
19646 rtl8168_mdio_write(tp, 0x14, 0xd1f5);
19647 rtl8168_mdio_write(tp, 0x14, 0xee80);
19648 rtl8168_mdio_write(tp, 0x14, 0xd2a9);
19649 rtl8168_mdio_write(tp, 0x14, 0xee80);
19650 rtl8168_mdio_write(tp, 0x14, 0xd30a);
19651 rtl8168_mdio_write(tp, 0x14, 0xee80);
19652 rtl8168_mdio_write(tp, 0x14, 0xf010);
19653 rtl8168_mdio_write(tp, 0x14, 0xee80);
19654 rtl8168_mdio_write(tp, 0x14, 0xf38f);
19655 rtl8168_mdio_write(tp, 0x14, 0xee81);
19656 rtl8168_mdio_write(tp, 0x14, 0x011e);
19657 rtl8168_mdio_write(tp, 0x14, 0xee81);
19658 rtl8168_mdio_write(tp, 0x14, 0x0b4a);
19659 rtl8168_mdio_write(tp, 0x14, 0xee81);
19660 rtl8168_mdio_write(tp, 0x14, 0x0c7c);
19661 rtl8168_mdio_write(tp, 0x14, 0xee81);
19662 rtl8168_mdio_write(tp, 0x14, 0x127f);
19663 rtl8168_mdio_write(tp, 0x14, 0xd100);
19664 rtl8168_mdio_write(tp, 0x14, 0x0210);
19665 rtl8168_mdio_write(tp, 0x14, 0xb5ee);
19666 rtl8168_mdio_write(tp, 0x14, 0x8088);
19667 rtl8168_mdio_write(tp, 0x14, 0xa4ee);
19668 rtl8168_mdio_write(tp, 0x14, 0x8089);
19669 rtl8168_mdio_write(tp, 0x14, 0x44ee);
19670 rtl8168_mdio_write(tp, 0x14, 0x809a);
19671 rtl8168_mdio_write(tp, 0x14, 0xa4ee);
19672 rtl8168_mdio_write(tp, 0x14, 0x809b);
19673 rtl8168_mdio_write(tp, 0x14, 0x44ee);
19674 rtl8168_mdio_write(tp, 0x14, 0x809c);
19675 rtl8168_mdio_write(tp, 0x14, 0xa7ee);
19676 rtl8168_mdio_write(tp, 0x14, 0x80a5);
19677 rtl8168_mdio_write(tp, 0x14, 0xa7d2);
19678 rtl8168_mdio_write(tp, 0x14, 0x0002);
19679 rtl8168_mdio_write(tp, 0x14, 0x0e66);
19680 rtl8168_mdio_write(tp, 0x14, 0x0285);
19681 rtl8168_mdio_write(tp, 0x14, 0xc0ee);
19682 rtl8168_mdio_write(tp, 0x14, 0x87fc);
19683 rtl8168_mdio_write(tp, 0x14, 0x00e0);
19684 rtl8168_mdio_write(tp, 0x14, 0x8245);
19685 rtl8168_mdio_write(tp, 0x14, 0xf622);
19686 rtl8168_mdio_write(tp, 0x14, 0xe482);
19687 rtl8168_mdio_write(tp, 0x14, 0x45ef);
19688 rtl8168_mdio_write(tp, 0x14, 0x96fe);
19689 rtl8168_mdio_write(tp, 0x14, 0xfdfc);
19690 rtl8168_mdio_write(tp, 0x14, 0x0402);
19691 rtl8168_mdio_write(tp, 0x14, 0x847a);
19692 rtl8168_mdio_write(tp, 0x14, 0x0284);
19693 rtl8168_mdio_write(tp, 0x14, 0xb302);
19694 rtl8168_mdio_write(tp, 0x14, 0x0cab);
19695 rtl8168_mdio_write(tp, 0x14, 0x020c);
19696 rtl8168_mdio_write(tp, 0x14, 0xc402);
19697 rtl8168_mdio_write(tp, 0x14, 0x0cef);
19698 rtl8168_mdio_write(tp, 0x14, 0x020d);
19699 rtl8168_mdio_write(tp, 0x14, 0x0802);
19700 rtl8168_mdio_write(tp, 0x14, 0x0d33);
19701 rtl8168_mdio_write(tp, 0x14, 0x020c);
19702 rtl8168_mdio_write(tp, 0x14, 0x3d04);
19703 rtl8168_mdio_write(tp, 0x14, 0xf8fa);
19704 rtl8168_mdio_write(tp, 0x14, 0xef69);
19705 rtl8168_mdio_write(tp, 0x14, 0xe182);
19706 rtl8168_mdio_write(tp, 0x14, 0x2fac);
19707 rtl8168_mdio_write(tp, 0x14, 0x291a);
19708 rtl8168_mdio_write(tp, 0x14, 0xe082);
19709 rtl8168_mdio_write(tp, 0x14, 0x24ac);
19710 rtl8168_mdio_write(tp, 0x14, 0x2102);
19711 rtl8168_mdio_write(tp, 0x14, 0xae22);
19712 rtl8168_mdio_write(tp, 0x14, 0x0210);
19713 rtl8168_mdio_write(tp, 0x14, 0x57f6);
19714 rtl8168_mdio_write(tp, 0x14, 0x21e4);
19715 rtl8168_mdio_write(tp, 0x14, 0x8224);
19716 rtl8168_mdio_write(tp, 0x14, 0xd101);
19717 rtl8168_mdio_write(tp, 0x14, 0xbf44);
19718 rtl8168_mdio_write(tp, 0x14, 0xd202);
19719 rtl8168_mdio_write(tp, 0x14, 0x4259);
19720 rtl8168_mdio_write(tp, 0x14, 0xae10);
19721 rtl8168_mdio_write(tp, 0x14, 0x0212);
19722 rtl8168_mdio_write(tp, 0x14, 0x4cf6);
19723 rtl8168_mdio_write(tp, 0x14, 0x29e5);
19724 rtl8168_mdio_write(tp, 0x14, 0x822f);
19725 rtl8168_mdio_write(tp, 0x14, 0xe082);
19726 rtl8168_mdio_write(tp, 0x14, 0x24f6);
19727 rtl8168_mdio_write(tp, 0x14, 0x21e4);
19728 rtl8168_mdio_write(tp, 0x14, 0x8224);
19729 rtl8168_mdio_write(tp, 0x14, 0xef96);
19730 rtl8168_mdio_write(tp, 0x14, 0xfefc);
19731 rtl8168_mdio_write(tp, 0x14, 0x04f8);
19732 rtl8168_mdio_write(tp, 0x14, 0xe182);
19733 rtl8168_mdio_write(tp, 0x14, 0x2fac);
19734 rtl8168_mdio_write(tp, 0x14, 0x2a18);
19735 rtl8168_mdio_write(tp, 0x14, 0xe082);
19736 rtl8168_mdio_write(tp, 0x14, 0x24ac);
19737 rtl8168_mdio_write(tp, 0x14, 0x2202);
19738 rtl8168_mdio_write(tp, 0x14, 0xae26);
19739 rtl8168_mdio_write(tp, 0x14, 0x0284);
19740 rtl8168_mdio_write(tp, 0x14, 0xf802);
19741 rtl8168_mdio_write(tp, 0x14, 0x8565);
19742 rtl8168_mdio_write(tp, 0x14, 0xd101);
19743 rtl8168_mdio_write(tp, 0x14, 0xbf44);
19744 rtl8168_mdio_write(tp, 0x14, 0xd502);
19745 rtl8168_mdio_write(tp, 0x14, 0x4259);
19746 rtl8168_mdio_write(tp, 0x14, 0xae0e);
19747 rtl8168_mdio_write(tp, 0x14, 0x0284);
19748 rtl8168_mdio_write(tp, 0x14, 0xea02);
19749 rtl8168_mdio_write(tp, 0x14, 0x85a9);
19750 rtl8168_mdio_write(tp, 0x14, 0xe182);
19751 rtl8168_mdio_write(tp, 0x14, 0x2ff6);
19752 rtl8168_mdio_write(tp, 0x14, 0x2ae5);
19753 rtl8168_mdio_write(tp, 0x14, 0x822f);
19754 rtl8168_mdio_write(tp, 0x14, 0xe082);
19755 rtl8168_mdio_write(tp, 0x14, 0x24f6);
19756 rtl8168_mdio_write(tp, 0x14, 0x22e4);
19757 rtl8168_mdio_write(tp, 0x14, 0x8224);
19758 rtl8168_mdio_write(tp, 0x14, 0xfc04);
19759 rtl8168_mdio_write(tp, 0x14, 0xf9e2);
19760 rtl8168_mdio_write(tp, 0x14, 0x8011);
19761 rtl8168_mdio_write(tp, 0x14, 0xad31);
19762 rtl8168_mdio_write(tp, 0x14, 0x05d2);
19763 rtl8168_mdio_write(tp, 0x14, 0x0002);
19764 rtl8168_mdio_write(tp, 0x14, 0x0e66);
19765 rtl8168_mdio_write(tp, 0x14, 0xfd04);
19766 rtl8168_mdio_write(tp, 0x14, 0xf8f9);
19767 rtl8168_mdio_write(tp, 0x14, 0xfaef);
19768 rtl8168_mdio_write(tp, 0x14, 0x69e0);
19769 rtl8168_mdio_write(tp, 0x14, 0x8011);
19770 rtl8168_mdio_write(tp, 0x14, 0xad21);
19771 rtl8168_mdio_write(tp, 0x14, 0x5cbf);
19772 rtl8168_mdio_write(tp, 0x14, 0x43be);
19773 rtl8168_mdio_write(tp, 0x14, 0x0242);
19774 rtl8168_mdio_write(tp, 0x14, 0x97ac);
19775 rtl8168_mdio_write(tp, 0x14, 0x281b);
19776 rtl8168_mdio_write(tp, 0x14, 0xbf43);
19777 rtl8168_mdio_write(tp, 0x14, 0xc102);
19778 rtl8168_mdio_write(tp, 0x14, 0x4297);
19779 rtl8168_mdio_write(tp, 0x14, 0xac28);
19780 rtl8168_mdio_write(tp, 0x14, 0x12bf);
19781 rtl8168_mdio_write(tp, 0x14, 0x43c7);
19782 rtl8168_mdio_write(tp, 0x14, 0x0242);
19783 rtl8168_mdio_write(tp, 0x14, 0x97ac);
19784 rtl8168_mdio_write(tp, 0x14, 0x2804);
19785 rtl8168_mdio_write(tp, 0x14, 0xd300);
19786 rtl8168_mdio_write(tp, 0x14, 0xae07);
19787 rtl8168_mdio_write(tp, 0x14, 0xd306);
19788 rtl8168_mdio_write(tp, 0x14, 0xaf85);
19789 rtl8168_mdio_write(tp, 0x14, 0x56d3);
19790 rtl8168_mdio_write(tp, 0x14, 0x03e0);
19791 rtl8168_mdio_write(tp, 0x14, 0x8011);
19792 rtl8168_mdio_write(tp, 0x14, 0xad26);
19793 rtl8168_mdio_write(tp, 0x14, 0x25bf);
19794 rtl8168_mdio_write(tp, 0x14, 0x4559);
19795 rtl8168_mdio_write(tp, 0x14, 0x0242);
19796 rtl8168_mdio_write(tp, 0x14, 0x97e2);
19797 rtl8168_mdio_write(tp, 0x14, 0x8073);
19798 rtl8168_mdio_write(tp, 0x14, 0x0d21);
19799 rtl8168_mdio_write(tp, 0x14, 0xf637);
19800 rtl8168_mdio_write(tp, 0x14, 0x0d11);
19801 rtl8168_mdio_write(tp, 0x14, 0xf62f);
19802 rtl8168_mdio_write(tp, 0x14, 0x1b21);
19803 rtl8168_mdio_write(tp, 0x14, 0xaa02);
19804 rtl8168_mdio_write(tp, 0x14, 0xae10);
19805 rtl8168_mdio_write(tp, 0x14, 0xe280);
19806 rtl8168_mdio_write(tp, 0x14, 0x740d);
19807 rtl8168_mdio_write(tp, 0x14, 0x21f6);
19808 rtl8168_mdio_write(tp, 0x14, 0x371b);
19809 rtl8168_mdio_write(tp, 0x14, 0x21aa);
19810 rtl8168_mdio_write(tp, 0x14, 0x0313);
19811 rtl8168_mdio_write(tp, 0x14, 0xae02);
19812 rtl8168_mdio_write(tp, 0x14, 0x2b02);
19813 rtl8168_mdio_write(tp, 0x14, 0x020e);
19814 rtl8168_mdio_write(tp, 0x14, 0x5102);
19815 rtl8168_mdio_write(tp, 0x14, 0x0e66);
19816 rtl8168_mdio_write(tp, 0x14, 0x020f);
19817 rtl8168_mdio_write(tp, 0x14, 0xa3ef);
19818 rtl8168_mdio_write(tp, 0x14, 0x96fe);
19819 rtl8168_mdio_write(tp, 0x14, 0xfdfc);
19820 rtl8168_mdio_write(tp, 0x14, 0x04f8);
19821 rtl8168_mdio_write(tp, 0x14, 0xf9fa);
19822 rtl8168_mdio_write(tp, 0x14, 0xef69);
19823 rtl8168_mdio_write(tp, 0x14, 0xe080);
19824 rtl8168_mdio_write(tp, 0x14, 0x12ad);
19825 rtl8168_mdio_write(tp, 0x14, 0x2733);
19826 rtl8168_mdio_write(tp, 0x14, 0xbf43);
19827 rtl8168_mdio_write(tp, 0x14, 0xbe02);
19828 rtl8168_mdio_write(tp, 0x14, 0x4297);
19829 rtl8168_mdio_write(tp, 0x14, 0xac28);
19830 rtl8168_mdio_write(tp, 0x14, 0x09bf);
19831 rtl8168_mdio_write(tp, 0x14, 0x43c1);
19832 rtl8168_mdio_write(tp, 0x14, 0x0242);
19833 rtl8168_mdio_write(tp, 0x14, 0x97ad);
19834 rtl8168_mdio_write(tp, 0x14, 0x2821);
19835 rtl8168_mdio_write(tp, 0x14, 0xbf45);
19836 rtl8168_mdio_write(tp, 0x14, 0x5902);
19837 rtl8168_mdio_write(tp, 0x14, 0x4297);
19838 rtl8168_mdio_write(tp, 0x14, 0xe387);
19839 rtl8168_mdio_write(tp, 0x14, 0xffd2);
19840 rtl8168_mdio_write(tp, 0x14, 0x001b);
19841 rtl8168_mdio_write(tp, 0x14, 0x45ac);
19842 rtl8168_mdio_write(tp, 0x14, 0x2711);
19843 rtl8168_mdio_write(tp, 0x14, 0xe187);
19844 rtl8168_mdio_write(tp, 0x14, 0xfebf);
19845 rtl8168_mdio_write(tp, 0x14, 0x87e4);
19846 rtl8168_mdio_write(tp, 0x14, 0x0242);
19847 rtl8168_mdio_write(tp, 0x14, 0x590d);
19848 rtl8168_mdio_write(tp, 0x14, 0x11bf);
19849 rtl8168_mdio_write(tp, 0x14, 0x87e7);
19850 rtl8168_mdio_write(tp, 0x14, 0x0242);
19851 rtl8168_mdio_write(tp, 0x14, 0x59ef);
19852 rtl8168_mdio_write(tp, 0x14, 0x96fe);
19853 rtl8168_mdio_write(tp, 0x14, 0xfdfc);
19854 rtl8168_mdio_write(tp, 0x14, 0x04f8);
19855 rtl8168_mdio_write(tp, 0x14, 0xfaef);
19856 rtl8168_mdio_write(tp, 0x14, 0x69d1);
19857 rtl8168_mdio_write(tp, 0x14, 0x00bf);
19858 rtl8168_mdio_write(tp, 0x14, 0x87e4);
19859 rtl8168_mdio_write(tp, 0x14, 0x0242);
19860 rtl8168_mdio_write(tp, 0x14, 0x59bf);
19861 rtl8168_mdio_write(tp, 0x14, 0x87e7);
19862 rtl8168_mdio_write(tp, 0x14, 0x0242);
19863 rtl8168_mdio_write(tp, 0x14, 0x59ef);
19864 rtl8168_mdio_write(tp, 0x14, 0x96fe);
19865 rtl8168_mdio_write(tp, 0x14, 0xfc04);
19866 rtl8168_mdio_write(tp, 0x14, 0xee87);
19867 rtl8168_mdio_write(tp, 0x14, 0xff46);
19868 rtl8168_mdio_write(tp, 0x14, 0xee87);
19869 rtl8168_mdio_write(tp, 0x14, 0xfe01);
19870 rtl8168_mdio_write(tp, 0x14, 0x04f8);
19871 rtl8168_mdio_write(tp, 0x14, 0xfaef);
19872 rtl8168_mdio_write(tp, 0x14, 0x69e0);
19873 rtl8168_mdio_write(tp, 0x14, 0x8241);
19874 rtl8168_mdio_write(tp, 0x14, 0xa000);
19875 rtl8168_mdio_write(tp, 0x14, 0x0502);
19876 rtl8168_mdio_write(tp, 0x14, 0x85eb);
19877 rtl8168_mdio_write(tp, 0x14, 0xae0e);
19878 rtl8168_mdio_write(tp, 0x14, 0xa001);
19879 rtl8168_mdio_write(tp, 0x14, 0x0502);
19880 rtl8168_mdio_write(tp, 0x14, 0x1a5a);
19881 rtl8168_mdio_write(tp, 0x14, 0xae06);
19882 rtl8168_mdio_write(tp, 0x14, 0xa002);
19883 rtl8168_mdio_write(tp, 0x14, 0x0302);
19884 rtl8168_mdio_write(tp, 0x14, 0x1ae6);
19885 rtl8168_mdio_write(tp, 0x14, 0xef96);
19886 rtl8168_mdio_write(tp, 0x14, 0xfefc);
19887 rtl8168_mdio_write(tp, 0x14, 0x04f8);
19888 rtl8168_mdio_write(tp, 0x14, 0xf9fa);
19889 rtl8168_mdio_write(tp, 0x14, 0xef69);
19890 rtl8168_mdio_write(tp, 0x14, 0xe082);
19891 rtl8168_mdio_write(tp, 0x14, 0x29f6);
19892 rtl8168_mdio_write(tp, 0x14, 0x21e4);
19893 rtl8168_mdio_write(tp, 0x14, 0x8229);
19894 rtl8168_mdio_write(tp, 0x14, 0xe080);
19895 rtl8168_mdio_write(tp, 0x14, 0x10ac);
19896 rtl8168_mdio_write(tp, 0x14, 0x2202);
19897 rtl8168_mdio_write(tp, 0x14, 0xae76);
19898 rtl8168_mdio_write(tp, 0x14, 0xe082);
19899 rtl8168_mdio_write(tp, 0x14, 0x27f7);
19900 rtl8168_mdio_write(tp, 0x14, 0x21e4);
19901 rtl8168_mdio_write(tp, 0x14, 0x8227);
19902 rtl8168_mdio_write(tp, 0x14, 0xbf43);
19903 rtl8168_mdio_write(tp, 0x14, 0x1302);
19904 rtl8168_mdio_write(tp, 0x14, 0x4297);
19905 rtl8168_mdio_write(tp, 0x14, 0xef21);
19906 rtl8168_mdio_write(tp, 0x14, 0xbf43);
19907 rtl8168_mdio_write(tp, 0x14, 0x1602);
19908 rtl8168_mdio_write(tp, 0x14, 0x4297);
19909 rtl8168_mdio_write(tp, 0x14, 0x0c11);
19910 rtl8168_mdio_write(tp, 0x14, 0x1e21);
19911 rtl8168_mdio_write(tp, 0x14, 0xbf43);
19912 rtl8168_mdio_write(tp, 0x14, 0x1902);
19913 rtl8168_mdio_write(tp, 0x14, 0x4297);
19914 rtl8168_mdio_write(tp, 0x14, 0x0c12);
19915 rtl8168_mdio_write(tp, 0x14, 0x1e21);
19916 rtl8168_mdio_write(tp, 0x14, 0xe682);
19917 rtl8168_mdio_write(tp, 0x14, 0x43a2);
19918 rtl8168_mdio_write(tp, 0x14, 0x000a);
19919 rtl8168_mdio_write(tp, 0x14, 0xe182);
19920 rtl8168_mdio_write(tp, 0x14, 0x27f6);
19921 rtl8168_mdio_write(tp, 0x14, 0x29e5);
19922 rtl8168_mdio_write(tp, 0x14, 0x8227);
19923 rtl8168_mdio_write(tp, 0x14, 0xae42);
19924 rtl8168_mdio_write(tp, 0x14, 0xe082);
19925 rtl8168_mdio_write(tp, 0x14, 0x44f7);
19926 rtl8168_mdio_write(tp, 0x14, 0x21e4);
19927 rtl8168_mdio_write(tp, 0x14, 0x8244);
19928 rtl8168_mdio_write(tp, 0x14, 0x0246);
19929 rtl8168_mdio_write(tp, 0x14, 0xaebf);
19930 rtl8168_mdio_write(tp, 0x14, 0x4325);
19931 rtl8168_mdio_write(tp, 0x14, 0x0242);
19932 rtl8168_mdio_write(tp, 0x14, 0x97ef);
19933 rtl8168_mdio_write(tp, 0x14, 0x21bf);
19934 rtl8168_mdio_write(tp, 0x14, 0x431c);
19935 rtl8168_mdio_write(tp, 0x14, 0x0242);
19936 rtl8168_mdio_write(tp, 0x14, 0x970c);
19937 rtl8168_mdio_write(tp, 0x14, 0x121e);
19938 rtl8168_mdio_write(tp, 0x14, 0x21bf);
19939 rtl8168_mdio_write(tp, 0x14, 0x431f);
19940 rtl8168_mdio_write(tp, 0x14, 0x0242);
19941 rtl8168_mdio_write(tp, 0x14, 0x970c);
19942 rtl8168_mdio_write(tp, 0x14, 0x131e);
19943 rtl8168_mdio_write(tp, 0x14, 0x21bf);
19944 rtl8168_mdio_write(tp, 0x14, 0x4328);
19945 rtl8168_mdio_write(tp, 0x14, 0x0242);
19946 rtl8168_mdio_write(tp, 0x14, 0x970c);
19947 rtl8168_mdio_write(tp, 0x14, 0x141e);
19948 rtl8168_mdio_write(tp, 0x14, 0x21bf);
19949 rtl8168_mdio_write(tp, 0x14, 0x44b1);
19950 rtl8168_mdio_write(tp, 0x14, 0x0242);
19951 rtl8168_mdio_write(tp, 0x14, 0x970c);
19952 rtl8168_mdio_write(tp, 0x14, 0x161e);
19953 rtl8168_mdio_write(tp, 0x14, 0x21e6);
19954 rtl8168_mdio_write(tp, 0x14, 0x8242);
19955 rtl8168_mdio_write(tp, 0x14, 0xee82);
19956 rtl8168_mdio_write(tp, 0x14, 0x4101);
19957 rtl8168_mdio_write(tp, 0x14, 0xef96);
19958 rtl8168_mdio_write(tp, 0x14, 0xfefd);
19959 rtl8168_mdio_write(tp, 0x14, 0xfc04);
19960 rtl8168_mdio_write(tp, 0x14, 0xf8fa);
19961 rtl8168_mdio_write(tp, 0x14, 0xef69);
19962 rtl8168_mdio_write(tp, 0x14, 0xe082);
19963 rtl8168_mdio_write(tp, 0x14, 0x46a0);
19964 rtl8168_mdio_write(tp, 0x14, 0x0005);
19965 rtl8168_mdio_write(tp, 0x14, 0x0286);
19966 rtl8168_mdio_write(tp, 0x14, 0x96ae);
19967 rtl8168_mdio_write(tp, 0x14, 0x06a0);
19968 rtl8168_mdio_write(tp, 0x14, 0x0103);
19969 rtl8168_mdio_write(tp, 0x14, 0x0219);
19970 rtl8168_mdio_write(tp, 0x14, 0x19ef);
19971 rtl8168_mdio_write(tp, 0x14, 0x96fe);
19972 rtl8168_mdio_write(tp, 0x14, 0xfc04);
19973 rtl8168_mdio_write(tp, 0x14, 0xf8fa);
19974 rtl8168_mdio_write(tp, 0x14, 0xef69);
19975 rtl8168_mdio_write(tp, 0x14, 0xe082);
19976 rtl8168_mdio_write(tp, 0x14, 0x29f6);
19977 rtl8168_mdio_write(tp, 0x14, 0x20e4);
19978 rtl8168_mdio_write(tp, 0x14, 0x8229);
19979 rtl8168_mdio_write(tp, 0x14, 0xe080);
19980 rtl8168_mdio_write(tp, 0x14, 0x10ac);
19981 rtl8168_mdio_write(tp, 0x14, 0x2102);
19982 rtl8168_mdio_write(tp, 0x14, 0xae54);
19983 rtl8168_mdio_write(tp, 0x14, 0xe082);
19984 rtl8168_mdio_write(tp, 0x14, 0x27f7);
19985 rtl8168_mdio_write(tp, 0x14, 0x20e4);
19986 rtl8168_mdio_write(tp, 0x14, 0x8227);
19987 rtl8168_mdio_write(tp, 0x14, 0xbf42);
19988 rtl8168_mdio_write(tp, 0x14, 0xe602);
19989 rtl8168_mdio_write(tp, 0x14, 0x4297);
19990 rtl8168_mdio_write(tp, 0x14, 0xac28);
19991 rtl8168_mdio_write(tp, 0x14, 0x22bf);
19992 rtl8168_mdio_write(tp, 0x14, 0x430d);
19993 rtl8168_mdio_write(tp, 0x14, 0x0242);
19994 rtl8168_mdio_write(tp, 0x14, 0x97e5);
19995 rtl8168_mdio_write(tp, 0x14, 0x8247);
19996 rtl8168_mdio_write(tp, 0x14, 0xac28);
19997 rtl8168_mdio_write(tp, 0x14, 0x20d1);
19998 rtl8168_mdio_write(tp, 0x14, 0x03bf);
19999 rtl8168_mdio_write(tp, 0x14, 0x4307);
20000 rtl8168_mdio_write(tp, 0x14, 0x0242);
20001 rtl8168_mdio_write(tp, 0x14, 0x59ee);
20002 rtl8168_mdio_write(tp, 0x14, 0x8246);
20003 rtl8168_mdio_write(tp, 0x14, 0x00e1);
20004 rtl8168_mdio_write(tp, 0x14, 0x8227);
20005 rtl8168_mdio_write(tp, 0x14, 0xf628);
20006 rtl8168_mdio_write(tp, 0x14, 0xe582);
20007 rtl8168_mdio_write(tp, 0x14, 0x27ae);
20008 rtl8168_mdio_write(tp, 0x14, 0x21d1);
20009 rtl8168_mdio_write(tp, 0x14, 0x04bf);
20010 rtl8168_mdio_write(tp, 0x14, 0x4307);
20011 rtl8168_mdio_write(tp, 0x14, 0x0242);
20012 rtl8168_mdio_write(tp, 0x14, 0x59ae);
20013 rtl8168_mdio_write(tp, 0x14, 0x08d1);
20014 rtl8168_mdio_write(tp, 0x14, 0x05bf);
20015 rtl8168_mdio_write(tp, 0x14, 0x4307);
20016 rtl8168_mdio_write(tp, 0x14, 0x0242);
20017 rtl8168_mdio_write(tp, 0x14, 0x59e0);
20018 rtl8168_mdio_write(tp, 0x14, 0x8244);
20019 rtl8168_mdio_write(tp, 0x14, 0xf720);
20020 rtl8168_mdio_write(tp, 0x14, 0xe482);
20021 rtl8168_mdio_write(tp, 0x14, 0x4402);
20022 rtl8168_mdio_write(tp, 0x14, 0x46ae);
20023 rtl8168_mdio_write(tp, 0x14, 0xee82);
20024 rtl8168_mdio_write(tp, 0x14, 0x4601);
20025 rtl8168_mdio_write(tp, 0x14, 0xef96);
20026 rtl8168_mdio_write(tp, 0x14, 0xfefc);
20027 rtl8168_mdio_write(tp, 0x14, 0x04f8);
20028 rtl8168_mdio_write(tp, 0x14, 0xfaef);
20029 rtl8168_mdio_write(tp, 0x14, 0x69e0);
20030 rtl8168_mdio_write(tp, 0x14, 0x8013);
20031 rtl8168_mdio_write(tp, 0x14, 0xad24);
20032 rtl8168_mdio_write(tp, 0x14, 0x1cbf);
20033 rtl8168_mdio_write(tp, 0x14, 0x87f0);
20034 rtl8168_mdio_write(tp, 0x14, 0x0242);
20035 rtl8168_mdio_write(tp, 0x14, 0x97ad);
20036 rtl8168_mdio_write(tp, 0x14, 0x2813);
20037 rtl8168_mdio_write(tp, 0x14, 0xe087);
20038 rtl8168_mdio_write(tp, 0x14, 0xfca0);
20039 rtl8168_mdio_write(tp, 0x14, 0x0005);
20040 rtl8168_mdio_write(tp, 0x14, 0x0287);
20041 rtl8168_mdio_write(tp, 0x14, 0x36ae);
20042 rtl8168_mdio_write(tp, 0x14, 0x10a0);
20043 rtl8168_mdio_write(tp, 0x14, 0x0105);
20044 rtl8168_mdio_write(tp, 0x14, 0x0287);
20045 rtl8168_mdio_write(tp, 0x14, 0x48ae);
20046 rtl8168_mdio_write(tp, 0x14, 0x08e0);
20047 rtl8168_mdio_write(tp, 0x14, 0x8230);
20048 rtl8168_mdio_write(tp, 0x14, 0xf626);
20049 rtl8168_mdio_write(tp, 0x14, 0xe482);
20050 rtl8168_mdio_write(tp, 0x14, 0x30ef);
20051 rtl8168_mdio_write(tp, 0x14, 0x96fe);
20052 rtl8168_mdio_write(tp, 0x14, 0xfc04);
20053 rtl8168_mdio_write(tp, 0x14, 0xf8e0);
20054 rtl8168_mdio_write(tp, 0x14, 0x8245);
20055 rtl8168_mdio_write(tp, 0x14, 0xf722);
20056 rtl8168_mdio_write(tp, 0x14, 0xe482);
20057 rtl8168_mdio_write(tp, 0x14, 0x4502);
20058 rtl8168_mdio_write(tp, 0x14, 0x46ae);
20059 rtl8168_mdio_write(tp, 0x14, 0xee87);
20060 rtl8168_mdio_write(tp, 0x14, 0xfc01);
20061 rtl8168_mdio_write(tp, 0x14, 0xfc04);
20062 rtl8168_mdio_write(tp, 0x14, 0xf8fa);
20063 rtl8168_mdio_write(tp, 0x14, 0xef69);
20064 rtl8168_mdio_write(tp, 0x14, 0xfb02);
20065 rtl8168_mdio_write(tp, 0x14, 0x46d3);
20066 rtl8168_mdio_write(tp, 0x14, 0xad50);
20067 rtl8168_mdio_write(tp, 0x14, 0x2fbf);
20068 rtl8168_mdio_write(tp, 0x14, 0x87ed);
20069 rtl8168_mdio_write(tp, 0x14, 0xd101);
20070 rtl8168_mdio_write(tp, 0x14, 0x0242);
20071 rtl8168_mdio_write(tp, 0x14, 0x59bf);
20072 rtl8168_mdio_write(tp, 0x14, 0x87ed);
20073 rtl8168_mdio_write(tp, 0x14, 0xd100);
20074 rtl8168_mdio_write(tp, 0x14, 0x0242);
20075 rtl8168_mdio_write(tp, 0x14, 0x59e0);
20076 rtl8168_mdio_write(tp, 0x14, 0x8245);
20077 rtl8168_mdio_write(tp, 0x14, 0xf622);
20078 rtl8168_mdio_write(tp, 0x14, 0xe482);
20079 rtl8168_mdio_write(tp, 0x14, 0x4502);
20080 rtl8168_mdio_write(tp, 0x14, 0x46ae);
20081 rtl8168_mdio_write(tp, 0x14, 0xd100);
20082 rtl8168_mdio_write(tp, 0x14, 0xbf87);
20083 rtl8168_mdio_write(tp, 0x14, 0xf002);
20084 rtl8168_mdio_write(tp, 0x14, 0x4259);
20085 rtl8168_mdio_write(tp, 0x14, 0xee87);
20086 rtl8168_mdio_write(tp, 0x14, 0xfc00);
20087 rtl8168_mdio_write(tp, 0x14, 0xe082);
20088 rtl8168_mdio_write(tp, 0x14, 0x30f6);
20089 rtl8168_mdio_write(tp, 0x14, 0x26e4);
20090 rtl8168_mdio_write(tp, 0x14, 0x8230);
20091 rtl8168_mdio_write(tp, 0x14, 0xffef);
20092 rtl8168_mdio_write(tp, 0x14, 0x96fe);
20093 rtl8168_mdio_write(tp, 0x14, 0xfc04);
20094 rtl8168_mdio_write(tp, 0x14, 0xf8f9);
20095 rtl8168_mdio_write(tp, 0x14, 0xface);
20096 rtl8168_mdio_write(tp, 0x14, 0xfaef);
20097 rtl8168_mdio_write(tp, 0x14, 0x69fb);
20098 rtl8168_mdio_write(tp, 0x14, 0xbf87);
20099 rtl8168_mdio_write(tp, 0x14, 0xb3d7);
20100 rtl8168_mdio_write(tp, 0x14, 0x001c);
20101 rtl8168_mdio_write(tp, 0x14, 0xd819);
20102 rtl8168_mdio_write(tp, 0x14, 0xd919);
20103 rtl8168_mdio_write(tp, 0x14, 0xda19);
20104 rtl8168_mdio_write(tp, 0x14, 0xdb19);
20105 rtl8168_mdio_write(tp, 0x14, 0x07ef);
20106 rtl8168_mdio_write(tp, 0x14, 0x9502);
20107 rtl8168_mdio_write(tp, 0x14, 0x4259);
20108 rtl8168_mdio_write(tp, 0x14, 0x073f);
20109 rtl8168_mdio_write(tp, 0x14, 0x0004);
20110 rtl8168_mdio_write(tp, 0x14, 0x9fec);
20111 rtl8168_mdio_write(tp, 0x14, 0xffef);
20112 rtl8168_mdio_write(tp, 0x14, 0x96fe);
20113 rtl8168_mdio_write(tp, 0x14, 0xc6fe);
20114 rtl8168_mdio_write(tp, 0x14, 0xfdfc);
20115 rtl8168_mdio_write(tp, 0x14, 0x0400);
20116 rtl8168_mdio_write(tp, 0x14, 0x0145);
20117 rtl8168_mdio_write(tp, 0x14, 0x7d00);
20118 rtl8168_mdio_write(tp, 0x14, 0x0345);
20119 rtl8168_mdio_write(tp, 0x14, 0x5c00);
20120 rtl8168_mdio_write(tp, 0x14, 0x0143);
20121 rtl8168_mdio_write(tp, 0x14, 0x4f00);
20122 rtl8168_mdio_write(tp, 0x14, 0x0387);
20123 rtl8168_mdio_write(tp, 0x14, 0xdb00);
20124 rtl8168_mdio_write(tp, 0x14, 0x0987);
20125 rtl8168_mdio_write(tp, 0x14, 0xde00);
20126 rtl8168_mdio_write(tp, 0x14, 0x0987);
20127 rtl8168_mdio_write(tp, 0x14, 0xe100);
20128 rtl8168_mdio_write(tp, 0x14, 0x0087);
20129 rtl8168_mdio_write(tp, 0x14, 0xeaa4);
20130 rtl8168_mdio_write(tp, 0x14, 0x00b8);
20131 rtl8168_mdio_write(tp, 0x14, 0x20c4);
20132 rtl8168_mdio_write(tp, 0x14, 0x1600);
20133 rtl8168_mdio_write(tp, 0x14, 0x000f);
20134 rtl8168_mdio_write(tp, 0x14, 0xf800);
20135 rtl8168_mdio_write(tp, 0x14, 0x7098);
20136 rtl8168_mdio_write(tp, 0x14, 0xa58a);
20137 rtl8168_mdio_write(tp, 0x14, 0xb6a8);
20138 rtl8168_mdio_write(tp, 0x14, 0x3e50);
20139 rtl8168_mdio_write(tp, 0x14, 0xa83e);
20140 rtl8168_mdio_write(tp, 0x14, 0x33bc);
20141 rtl8168_mdio_write(tp, 0x14, 0xc622);
20142 rtl8168_mdio_write(tp, 0x14, 0xbcc6);
20143 rtl8168_mdio_write(tp, 0x14, 0xaaa4);
20144 rtl8168_mdio_write(tp, 0x14, 0x42ff);
20145 rtl8168_mdio_write(tp, 0x14, 0xc408);
20146 rtl8168_mdio_write(tp, 0x14, 0x00c4);
20147 rtl8168_mdio_write(tp, 0x14, 0x16a8);
20148 rtl8168_mdio_write(tp, 0x14, 0xbcc0);
20149 rtl8168_mdio_write(tp, 0x13, 0xb818);
20150 rtl8168_mdio_write(tp, 0x14, 0x02f3);
20151 rtl8168_mdio_write(tp, 0x13, 0xb81a);
20152 rtl8168_mdio_write(tp, 0x14, 0x17d1);
20153 rtl8168_mdio_write(tp, 0x13, 0xb81c);
20154 rtl8168_mdio_write(tp, 0x14, 0x185a);
20155 rtl8168_mdio_write(tp, 0x13, 0xb81e);
20156 rtl8168_mdio_write(tp, 0x14, 0x3c66);
20157 rtl8168_mdio_write(tp, 0x13, 0xb820);
20158 rtl8168_mdio_write(tp, 0x14, 0x021f);
20159 rtl8168_mdio_write(tp, 0x13, 0xc416);
20160 rtl8168_mdio_write(tp, 0x14, 0x0500);
20161 rtl8168_mdio_write(tp, 0x13, 0xb82e);
20162 rtl8168_mdio_write(tp, 0x14, 0xfffc);
20163
20164 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20165 rtl8168_mdio_write(tp, 0x13, 0x0000);
20166 rtl8168_mdio_write(tp, 0x14, 0x0000);
20167 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
20168 gphy_val = rtl8168_mdio_read(tp, 0x10);
20169 gphy_val &= ~(BIT_9);
20170 rtl8168_mdio_write(tp, 0x10, gphy_val);
20171 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20172 rtl8168_mdio_write(tp, 0x13, 0x8146);
20173 rtl8168_mdio_write(tp, 0x14, 0x0000);
20174
20175 rtl8168_clear_phy_mcu_patch_request(tp);
20176 }
20177
20178 static void
rtl8168_set_phy_mcu_8168gu_2(struct net_device * dev)20179 rtl8168_set_phy_mcu_8168gu_2(struct net_device *dev)
20180 {
20181 struct rtl8168_private *tp = netdev_priv(dev);
20182 unsigned int gphy_val;
20183
20184 rtl8168_set_phy_mcu_patch_request(tp);
20185 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20186 rtl8168_mdio_write(tp, 0x13, 0x8146);
20187 rtl8168_mdio_write(tp, 0x14, 0x0300);
20188 rtl8168_mdio_write(tp, 0x13, 0xB82E);
20189 rtl8168_mdio_write(tp, 0x14, 0x0001);
20190 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20191 rtl8168_mdio_write(tp, 0x13, 0xb820);
20192 rtl8168_mdio_write(tp, 0x14, 0x0290);
20193 rtl8168_mdio_write(tp, 0x13, 0xa012);
20194 rtl8168_mdio_write(tp, 0x14, 0x0000);
20195 rtl8168_mdio_write(tp, 0x13, 0xa014);
20196 rtl8168_mdio_write(tp, 0x14, 0x2c04);
20197 rtl8168_mdio_write(tp, 0x14, 0x2c07);
20198 rtl8168_mdio_write(tp, 0x14, 0x2c07);
20199 rtl8168_mdio_write(tp, 0x14, 0x2c07);
20200 rtl8168_mdio_write(tp, 0x14, 0xa304);
20201 rtl8168_mdio_write(tp, 0x14, 0xa301);
20202 rtl8168_mdio_write(tp, 0x14, 0x207e);
20203 rtl8168_mdio_write(tp, 0x13, 0xa01a);
20204 rtl8168_mdio_write(tp, 0x14, 0x0000);
20205 rtl8168_mdio_write(tp, 0x13, 0xa006);
20206 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20207 rtl8168_mdio_write(tp, 0x13, 0xa004);
20208 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20209 rtl8168_mdio_write(tp, 0x13, 0xa002);
20210 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20211 rtl8168_mdio_write(tp, 0x13, 0xa000);
20212 rtl8168_mdio_write(tp, 0x14, 0x107c);
20213 rtl8168_mdio_write(tp, 0x13, 0xb820);
20214 rtl8168_mdio_write(tp, 0x14, 0x0210);
20215 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20216 rtl8168_mdio_write(tp, 0x13, 0x0000);
20217 rtl8168_mdio_write(tp, 0x14, 0x0000);
20218 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
20219 gphy_val = rtl8168_mdio_read(tp, 0x17);
20220 gphy_val &= ~(BIT_0);
20221 rtl8168_mdio_write(tp, 0x17, gphy_val);
20222 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20223 rtl8168_mdio_write(tp, 0x13, 0x8146);
20224 rtl8168_mdio_write(tp, 0x14, 0x0000);
20225
20226 rtl8168_clear_phy_mcu_patch_request(tp);
20227 }
20228
20229 static void
rtl8168_set_phy_mcu_8411b_1(struct net_device * dev)20230 rtl8168_set_phy_mcu_8411b_1(struct net_device *dev)
20231 {
20232 struct rtl8168_private *tp = netdev_priv(dev);
20233 unsigned int gphy_val;
20234
20235 rtl8168_set_phy_mcu_patch_request(tp);
20236
20237 rtl8168_mdio_write(tp,0x1f, 0x0A43);
20238 rtl8168_mdio_write(tp,0x13, 0x8146);
20239 rtl8168_mdio_write(tp,0x14, 0x0100);
20240 rtl8168_mdio_write(tp,0x13, 0xB82E);
20241 rtl8168_mdio_write(tp,0x14, 0x0001);
20242
20243
20244 rtl8168_mdio_write(tp,0x1F, 0x0A43);
20245 rtl8168_mdio_write(tp, 0x13, 0xb820);
20246 rtl8168_mdio_write(tp, 0x14, 0x0290);
20247 rtl8168_mdio_write(tp, 0x13, 0xa012);
20248 rtl8168_mdio_write(tp, 0x14, 0x0000);
20249 rtl8168_mdio_write(tp, 0x13, 0xa014);
20250 rtl8168_mdio_write(tp, 0x14, 0x2c04);
20251 rtl8168_mdio_write(tp, 0x14, 0x2c07);
20252 rtl8168_mdio_write(tp, 0x14, 0x2c07);
20253 rtl8168_mdio_write(tp, 0x14, 0x2c07);
20254 rtl8168_mdio_write(tp, 0x14, 0xa304);
20255 rtl8168_mdio_write(tp, 0x14, 0xa301);
20256 rtl8168_mdio_write(tp, 0x14, 0x207e);
20257 rtl8168_mdio_write(tp, 0x13, 0xa01a);
20258 rtl8168_mdio_write(tp, 0x14, 0x0000);
20259 rtl8168_mdio_write(tp, 0x13, 0xa006);
20260 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20261 rtl8168_mdio_write(tp, 0x13, 0xa004);
20262 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20263 rtl8168_mdio_write(tp, 0x13, 0xa002);
20264 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20265 rtl8168_mdio_write(tp, 0x13, 0xa000);
20266 rtl8168_mdio_write(tp, 0x14, 0x107c);
20267 rtl8168_mdio_write(tp, 0x13, 0xb820);
20268 rtl8168_mdio_write(tp, 0x14, 0x0210);
20269
20270
20271 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20272 rtl8168_mdio_write(tp, 0x13, 0x0000);
20273 rtl8168_mdio_write(tp, 0x14, 0x0000);
20274 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
20275 gphy_val = rtl8168_mdio_read(tp, 0x17);
20276 gphy_val &= ~(BIT_0);
20277 rtl8168_mdio_write(tp, 0x17, gphy_val);
20278 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20279 rtl8168_mdio_write(tp, 0x13, 0x8146);
20280 rtl8168_mdio_write(tp, 0x14, 0x0000);
20281
20282 rtl8168_clear_phy_mcu_patch_request(tp);
20283 }
20284
20285 static void
rtl8168_set_phy_mcu_8168ep_2(struct net_device * dev)20286 rtl8168_set_phy_mcu_8168ep_2(struct net_device *dev)
20287 {
20288 struct rtl8168_private *tp = netdev_priv(dev);
20289 unsigned int gphy_val;
20290
20291 rtl8168_set_phy_mcu_patch_request(tp);
20292
20293 rtl8168_mdio_write(tp,0x1f, 0x0A43);
20294 rtl8168_mdio_write(tp,0x13, 0x8146);
20295 rtl8168_mdio_write(tp,0x14, 0x8700);
20296 rtl8168_mdio_write(tp,0x13, 0xB82E);
20297 rtl8168_mdio_write(tp,0x14, 0x0001);
20298
20299 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20300
20301 rtl8168_mdio_write(tp, 0x13, 0x83DD);
20302 rtl8168_mdio_write(tp, 0x14, 0xAF83);
20303 rtl8168_mdio_write(tp, 0x14, 0xE9AF);
20304 rtl8168_mdio_write(tp, 0x14, 0x83EE);
20305 rtl8168_mdio_write(tp, 0x14, 0xAF83);
20306 rtl8168_mdio_write(tp, 0x14, 0xF1A1);
20307 rtl8168_mdio_write(tp, 0x14, 0x83F4);
20308 rtl8168_mdio_write(tp, 0x14, 0xD149);
20309 rtl8168_mdio_write(tp, 0x14, 0xAF06);
20310 rtl8168_mdio_write(tp, 0x14, 0x47AF);
20311 rtl8168_mdio_write(tp, 0x14, 0x0000);
20312 rtl8168_mdio_write(tp, 0x14, 0xAF00);
20313 rtl8168_mdio_write(tp, 0x14, 0x00AF);
20314 rtl8168_mdio_write(tp, 0x14, 0x0000);
20315
20316 rtl8168_mdio_write(tp, 0x13, 0xB818);
20317 rtl8168_mdio_write(tp, 0x14, 0x0645);
20318
20319 rtl8168_mdio_write(tp, 0x13, 0xB81A);
20320 rtl8168_mdio_write(tp, 0x14, 0x0000);
20321
20322 rtl8168_mdio_write(tp, 0x13, 0xB81C);
20323 rtl8168_mdio_write(tp, 0x14, 0x0000);
20324
20325 rtl8168_mdio_write(tp, 0x13, 0xB81E);
20326 rtl8168_mdio_write(tp, 0x14, 0x0000);
20327
20328 rtl8168_mdio_write(tp, 0x13, 0xB832);
20329 rtl8168_mdio_write(tp, 0x14, 0x0001);
20330
20331 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20332 rtl8168_mdio_write(tp, 0x13, 0x0000);
20333 rtl8168_mdio_write(tp, 0x14, 0x0000);
20334 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
20335 gphy_val = rtl8168_mdio_read(tp, 0x17);
20336 gphy_val &= ~(BIT_0);
20337 rtl8168_mdio_write(tp, 0x17, gphy_val);
20338 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20339 rtl8168_mdio_write(tp, 0x13, 0x8146);
20340 rtl8168_mdio_write(tp, 0x14, 0x0000);
20341
20342 rtl8168_clear_phy_mcu_patch_request(tp);
20343 }
20344
20345 static void
rtl8168_set_phy_mcu_8168h_1(struct net_device * dev)20346 rtl8168_set_phy_mcu_8168h_1(struct net_device *dev)
20347 {
20348 struct rtl8168_private *tp = netdev_priv(dev);
20349 unsigned int gphy_val;
20350
20351 rtl8168_set_phy_mcu_patch_request(tp);
20352
20353 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20354 rtl8168_mdio_write(tp, 0x13, 0x8028);
20355 rtl8168_mdio_write(tp, 0x14, 0x6200);
20356 rtl8168_mdio_write(tp, 0x13, 0xB82E);
20357 rtl8168_mdio_write(tp, 0x14, 0x0001);
20358
20359
20360 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20361 rtl8168_mdio_write(tp, 0x13, 0xB820);
20362 rtl8168_mdio_write(tp, 0x14, 0x0290);
20363 rtl8168_mdio_write(tp, 0x13, 0xA012);
20364 rtl8168_mdio_write(tp, 0x14, 0x0000);
20365 rtl8168_mdio_write(tp, 0x13, 0xA014);
20366 rtl8168_mdio_write(tp, 0x14, 0x2c04);
20367 rtl8168_mdio_write(tp, 0x14, 0x2c10);
20368 rtl8168_mdio_write(tp, 0x14, 0x2c10);
20369 rtl8168_mdio_write(tp, 0x14, 0x2c10);
20370 rtl8168_mdio_write(tp, 0x14, 0xa210);
20371 rtl8168_mdio_write(tp, 0x14, 0xa101);
20372 rtl8168_mdio_write(tp, 0x14, 0xce10);
20373 rtl8168_mdio_write(tp, 0x14, 0xe070);
20374 rtl8168_mdio_write(tp, 0x14, 0x0f40);
20375 rtl8168_mdio_write(tp, 0x14, 0xaf01);
20376 rtl8168_mdio_write(tp, 0x14, 0x8f01);
20377 rtl8168_mdio_write(tp, 0x14, 0x183e);
20378 rtl8168_mdio_write(tp, 0x14, 0x8e10);
20379 rtl8168_mdio_write(tp, 0x14, 0x8101);
20380 rtl8168_mdio_write(tp, 0x14, 0x8210);
20381 rtl8168_mdio_write(tp, 0x14, 0x28da);
20382 rtl8168_mdio_write(tp, 0x13, 0xA01A);
20383 rtl8168_mdio_write(tp, 0x14, 0x0000);
20384 rtl8168_mdio_write(tp, 0x13, 0xA006);
20385 rtl8168_mdio_write(tp, 0x14, 0x0017);
20386 rtl8168_mdio_write(tp, 0x13, 0xA004);
20387 rtl8168_mdio_write(tp, 0x14, 0x0015);
20388 rtl8168_mdio_write(tp, 0x13, 0xA002);
20389 rtl8168_mdio_write(tp, 0x14, 0x0013);
20390 rtl8168_mdio_write(tp, 0x13, 0xA000);
20391 rtl8168_mdio_write(tp, 0x14, 0x18d1);
20392 rtl8168_mdio_write(tp, 0x13, 0xB820);
20393 rtl8168_mdio_write(tp, 0x14, 0x0210);
20394
20395
20396 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20397 rtl8168_mdio_write(tp, 0x13, 0x0000);
20398 rtl8168_mdio_write(tp, 0x14, 0x0000);
20399 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
20400 gphy_val = rtl8168_mdio_read(tp, 0x17);
20401 gphy_val &= ~(BIT_0);
20402 rtl8168_mdio_write(tp, 0x17, gphy_val);
20403 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20404 rtl8168_mdio_write(tp, 0x13, 0x8028);
20405 rtl8168_mdio_write(tp, 0x14, 0x0000);
20406
20407 rtl8168_clear_phy_mcu_patch_request(tp);
20408 }
20409
20410 static void
rtl8168_set_phy_mcu_8168h_2(struct net_device * dev)20411 rtl8168_set_phy_mcu_8168h_2(struct net_device *dev)
20412 {
20413 struct rtl8168_private *tp = netdev_priv(dev);
20414 unsigned int gphy_val;
20415
20416 rtl8168_set_phy_mcu_patch_request(tp);
20417
20418 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20419 rtl8168_mdio_write(tp, 0x13, 0x8028);
20420 rtl8168_mdio_write(tp, 0x14, 0x6201);
20421 rtl8168_mdio_write(tp, 0x13, 0xB82E);
20422 rtl8168_mdio_write(tp, 0x14, 0x0001);
20423
20424
20425 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20426 rtl8168_mdio_write(tp, 0x13, 0xB820);
20427 rtl8168_mdio_write(tp, 0x14, 0x0290);
20428 rtl8168_mdio_write(tp, 0x13, 0xA012);
20429 rtl8168_mdio_write(tp, 0x14, 0x0000);
20430 rtl8168_mdio_write(tp, 0x13, 0xA014);
20431 rtl8168_mdio_write(tp, 0x14, 0x2c04);
20432 rtl8168_mdio_write(tp, 0x14, 0x2c09);
20433 rtl8168_mdio_write(tp, 0x14, 0x2c09);
20434 rtl8168_mdio_write(tp, 0x14, 0x2c09);
20435 rtl8168_mdio_write(tp, 0x14, 0xad01);
20436 rtl8168_mdio_write(tp, 0x14, 0xad01);
20437 rtl8168_mdio_write(tp, 0x14, 0xad01);
20438 rtl8168_mdio_write(tp, 0x14, 0xad01);
20439 rtl8168_mdio_write(tp, 0x14, 0x236c);
20440 rtl8168_mdio_write(tp, 0x13, 0xA01A);
20441 rtl8168_mdio_write(tp, 0x14, 0x0000);
20442 rtl8168_mdio_write(tp, 0x13, 0xA006);
20443 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20444 rtl8168_mdio_write(tp, 0x13, 0xA004);
20445 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20446 rtl8168_mdio_write(tp, 0x13, 0xA002);
20447 rtl8168_mdio_write(tp, 0x14, 0x0fff);
20448 rtl8168_mdio_write(tp, 0x13, 0xA000);
20449 rtl8168_mdio_write(tp, 0x14, 0x136b);
20450 rtl8168_mdio_write(tp, 0x13, 0xB820);
20451 rtl8168_mdio_write(tp, 0x14, 0x0210);
20452
20453
20454 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20455 rtl8168_mdio_write(tp, 0x13, 0x8323);
20456 rtl8168_mdio_write(tp, 0x14, 0xaf83);
20457 rtl8168_mdio_write(tp, 0x14, 0x2faf);
20458 rtl8168_mdio_write(tp, 0x14, 0x853d);
20459 rtl8168_mdio_write(tp, 0x14, 0xaf85);
20460 rtl8168_mdio_write(tp, 0x14, 0x3daf);
20461 rtl8168_mdio_write(tp, 0x14, 0x853d);
20462 rtl8168_mdio_write(tp, 0x14, 0xe082);
20463 rtl8168_mdio_write(tp, 0x14, 0x45ad);
20464 rtl8168_mdio_write(tp, 0x14, 0x2052);
20465 rtl8168_mdio_write(tp, 0x14, 0xe082);
20466 rtl8168_mdio_write(tp, 0x14, 0x7ae3);
20467 rtl8168_mdio_write(tp, 0x14, 0x85fe);
20468 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20469 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20470 rtl8168_mdio_write(tp, 0x14, 0x85f6);
20471 rtl8168_mdio_write(tp, 0x14, 0xe082);
20472 rtl8168_mdio_write(tp, 0x14, 0x7a1b);
20473 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20474 rtl8168_mdio_write(tp, 0x14, 0x85fa);
20475 rtl8168_mdio_write(tp, 0x14, 0xe082);
20476 rtl8168_mdio_write(tp, 0x14, 0x7be3);
20477 rtl8168_mdio_write(tp, 0x14, 0x85fe);
20478 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20479 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20480 rtl8168_mdio_write(tp, 0x14, 0x85f7);
20481 rtl8168_mdio_write(tp, 0x14, 0xe082);
20482 rtl8168_mdio_write(tp, 0x14, 0x7b1b);
20483 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20484 rtl8168_mdio_write(tp, 0x14, 0x85fb);
20485 rtl8168_mdio_write(tp, 0x14, 0xe082);
20486 rtl8168_mdio_write(tp, 0x14, 0x7ce3);
20487 rtl8168_mdio_write(tp, 0x14, 0x85fe);
20488 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20489 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20490 rtl8168_mdio_write(tp, 0x14, 0x85f8);
20491 rtl8168_mdio_write(tp, 0x14, 0xe082);
20492 rtl8168_mdio_write(tp, 0x14, 0x7c1b);
20493 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20494 rtl8168_mdio_write(tp, 0x14, 0x85fc);
20495 rtl8168_mdio_write(tp, 0x14, 0xe082);
20496 rtl8168_mdio_write(tp, 0x14, 0x7de3);
20497 rtl8168_mdio_write(tp, 0x14, 0x85fe);
20498 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20499 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20500 rtl8168_mdio_write(tp, 0x14, 0x85f9);
20501 rtl8168_mdio_write(tp, 0x14, 0xe082);
20502 rtl8168_mdio_write(tp, 0x14, 0x7d1b);
20503 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20504 rtl8168_mdio_write(tp, 0x14, 0x85fd);
20505 rtl8168_mdio_write(tp, 0x14, 0xae50);
20506 rtl8168_mdio_write(tp, 0x14, 0xe082);
20507 rtl8168_mdio_write(tp, 0x14, 0x7ee3);
20508 rtl8168_mdio_write(tp, 0x14, 0x85ff);
20509 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20510 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20511 rtl8168_mdio_write(tp, 0x14, 0x85f6);
20512 rtl8168_mdio_write(tp, 0x14, 0xe082);
20513 rtl8168_mdio_write(tp, 0x14, 0x7e1b);
20514 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20515 rtl8168_mdio_write(tp, 0x14, 0x85fa);
20516 rtl8168_mdio_write(tp, 0x14, 0xe082);
20517 rtl8168_mdio_write(tp, 0x14, 0x7fe3);
20518 rtl8168_mdio_write(tp, 0x14, 0x85ff);
20519 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20520 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20521 rtl8168_mdio_write(tp, 0x14, 0x85f7);
20522 rtl8168_mdio_write(tp, 0x14, 0xe082);
20523 rtl8168_mdio_write(tp, 0x14, 0x7f1b);
20524 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20525 rtl8168_mdio_write(tp, 0x14, 0x85fb);
20526 rtl8168_mdio_write(tp, 0x14, 0xe082);
20527 rtl8168_mdio_write(tp, 0x14, 0x80e3);
20528 rtl8168_mdio_write(tp, 0x14, 0x85ff);
20529 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20530 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20531 rtl8168_mdio_write(tp, 0x14, 0x85f8);
20532 rtl8168_mdio_write(tp, 0x14, 0xe082);
20533 rtl8168_mdio_write(tp, 0x14, 0x801b);
20534 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20535 rtl8168_mdio_write(tp, 0x14, 0x85fc);
20536 rtl8168_mdio_write(tp, 0x14, 0xe082);
20537 rtl8168_mdio_write(tp, 0x14, 0x81e3);
20538 rtl8168_mdio_write(tp, 0x14, 0x85ff);
20539 rtl8168_mdio_write(tp, 0x14, 0x1a03);
20540 rtl8168_mdio_write(tp, 0x14, 0x10e4);
20541 rtl8168_mdio_write(tp, 0x14, 0x85f9);
20542 rtl8168_mdio_write(tp, 0x14, 0xe082);
20543 rtl8168_mdio_write(tp, 0x14, 0x811b);
20544 rtl8168_mdio_write(tp, 0x14, 0x03e4);
20545 rtl8168_mdio_write(tp, 0x14, 0x85fd);
20546 rtl8168_mdio_write(tp, 0x14, 0xe085);
20547 rtl8168_mdio_write(tp, 0x14, 0xf6ad);
20548 rtl8168_mdio_write(tp, 0x14, 0x2404);
20549 rtl8168_mdio_write(tp, 0x14, 0xee85);
20550 rtl8168_mdio_write(tp, 0x14, 0xf610);
20551 rtl8168_mdio_write(tp, 0x14, 0xe085);
20552 rtl8168_mdio_write(tp, 0x14, 0xf7ad);
20553 rtl8168_mdio_write(tp, 0x14, 0x2404);
20554 rtl8168_mdio_write(tp, 0x14, 0xee85);
20555 rtl8168_mdio_write(tp, 0x14, 0xf710);
20556 rtl8168_mdio_write(tp, 0x14, 0xe085);
20557 rtl8168_mdio_write(tp, 0x14, 0xf8ad);
20558 rtl8168_mdio_write(tp, 0x14, 0x2404);
20559 rtl8168_mdio_write(tp, 0x14, 0xee85);
20560 rtl8168_mdio_write(tp, 0x14, 0xf810);
20561 rtl8168_mdio_write(tp, 0x14, 0xe085);
20562 rtl8168_mdio_write(tp, 0x14, 0xf9ad);
20563 rtl8168_mdio_write(tp, 0x14, 0x2404);
20564 rtl8168_mdio_write(tp, 0x14, 0xee85);
20565 rtl8168_mdio_write(tp, 0x14, 0xf910);
20566 rtl8168_mdio_write(tp, 0x14, 0xe085);
20567 rtl8168_mdio_write(tp, 0x14, 0xfaad);
20568 rtl8168_mdio_write(tp, 0x14, 0x2704);
20569 rtl8168_mdio_write(tp, 0x14, 0xee85);
20570 rtl8168_mdio_write(tp, 0x14, 0xfa00);
20571 rtl8168_mdio_write(tp, 0x14, 0xe085);
20572 rtl8168_mdio_write(tp, 0x14, 0xfbad);
20573 rtl8168_mdio_write(tp, 0x14, 0x2704);
20574 rtl8168_mdio_write(tp, 0x14, 0xee85);
20575 rtl8168_mdio_write(tp, 0x14, 0xfb00);
20576 rtl8168_mdio_write(tp, 0x14, 0xe085);
20577 rtl8168_mdio_write(tp, 0x14, 0xfcad);
20578 rtl8168_mdio_write(tp, 0x14, 0x2704);
20579 rtl8168_mdio_write(tp, 0x14, 0xee85);
20580 rtl8168_mdio_write(tp, 0x14, 0xfc00);
20581 rtl8168_mdio_write(tp, 0x14, 0xe085);
20582 rtl8168_mdio_write(tp, 0x14, 0xfdad);
20583 rtl8168_mdio_write(tp, 0x14, 0x2704);
20584 rtl8168_mdio_write(tp, 0x14, 0xee85);
20585 rtl8168_mdio_write(tp, 0x14, 0xfd00);
20586 rtl8168_mdio_write(tp, 0x14, 0xe082);
20587 rtl8168_mdio_write(tp, 0x14, 0x44ad);
20588 rtl8168_mdio_write(tp, 0x14, 0x203f);
20589 rtl8168_mdio_write(tp, 0x14, 0xe085);
20590 rtl8168_mdio_write(tp, 0x14, 0xf6e4);
20591 rtl8168_mdio_write(tp, 0x14, 0x8288);
20592 rtl8168_mdio_write(tp, 0x14, 0xe085);
20593 rtl8168_mdio_write(tp, 0x14, 0xfae4);
20594 rtl8168_mdio_write(tp, 0x14, 0x8289);
20595 rtl8168_mdio_write(tp, 0x14, 0xe082);
20596 rtl8168_mdio_write(tp, 0x14, 0x440d);
20597 rtl8168_mdio_write(tp, 0x14, 0x0458);
20598 rtl8168_mdio_write(tp, 0x14, 0x01bf);
20599 rtl8168_mdio_write(tp, 0x14, 0x8264);
20600 rtl8168_mdio_write(tp, 0x14, 0x0215);
20601 rtl8168_mdio_write(tp, 0x14, 0x38bf);
20602 rtl8168_mdio_write(tp, 0x14, 0x824e);
20603 rtl8168_mdio_write(tp, 0x14, 0x0213);
20604 rtl8168_mdio_write(tp, 0x14, 0x06a0);
20605 rtl8168_mdio_write(tp, 0x14, 0x010f);
20606 rtl8168_mdio_write(tp, 0x14, 0xe082);
20607 rtl8168_mdio_write(tp, 0x14, 0x44f6);
20608 rtl8168_mdio_write(tp, 0x14, 0x20e4);
20609 rtl8168_mdio_write(tp, 0x14, 0x8244);
20610 rtl8168_mdio_write(tp, 0x14, 0x580f);
20611 rtl8168_mdio_write(tp, 0x14, 0xe582);
20612 rtl8168_mdio_write(tp, 0x14, 0x5aae);
20613 rtl8168_mdio_write(tp, 0x14, 0x0ebf);
20614 rtl8168_mdio_write(tp, 0x14, 0x825e);
20615 rtl8168_mdio_write(tp, 0x14, 0xe382);
20616 rtl8168_mdio_write(tp, 0x14, 0x44f7);
20617 rtl8168_mdio_write(tp, 0x14, 0x3ce7);
20618 rtl8168_mdio_write(tp, 0x14, 0x8244);
20619 rtl8168_mdio_write(tp, 0x14, 0x0212);
20620 rtl8168_mdio_write(tp, 0x14, 0xf0ad);
20621 rtl8168_mdio_write(tp, 0x14, 0x213f);
20622 rtl8168_mdio_write(tp, 0x14, 0xe085);
20623 rtl8168_mdio_write(tp, 0x14, 0xf7e4);
20624 rtl8168_mdio_write(tp, 0x14, 0x8288);
20625 rtl8168_mdio_write(tp, 0x14, 0xe085);
20626 rtl8168_mdio_write(tp, 0x14, 0xfbe4);
20627 rtl8168_mdio_write(tp, 0x14, 0x8289);
20628 rtl8168_mdio_write(tp, 0x14, 0xe082);
20629 rtl8168_mdio_write(tp, 0x14, 0x440d);
20630 rtl8168_mdio_write(tp, 0x14, 0x0558);
20631 rtl8168_mdio_write(tp, 0x14, 0x01bf);
20632 rtl8168_mdio_write(tp, 0x14, 0x826b);
20633 rtl8168_mdio_write(tp, 0x14, 0x0215);
20634 rtl8168_mdio_write(tp, 0x14, 0x38bf);
20635 rtl8168_mdio_write(tp, 0x14, 0x824f);
20636 rtl8168_mdio_write(tp, 0x14, 0x0213);
20637 rtl8168_mdio_write(tp, 0x14, 0x06a0);
20638 rtl8168_mdio_write(tp, 0x14, 0x010f);
20639 rtl8168_mdio_write(tp, 0x14, 0xe082);
20640 rtl8168_mdio_write(tp, 0x14, 0x44f6);
20641 rtl8168_mdio_write(tp, 0x14, 0x21e4);
20642 rtl8168_mdio_write(tp, 0x14, 0x8244);
20643 rtl8168_mdio_write(tp, 0x14, 0x580f);
20644 rtl8168_mdio_write(tp, 0x14, 0xe582);
20645 rtl8168_mdio_write(tp, 0x14, 0x5bae);
20646 rtl8168_mdio_write(tp, 0x14, 0x0ebf);
20647 rtl8168_mdio_write(tp, 0x14, 0x8265);
20648 rtl8168_mdio_write(tp, 0x14, 0xe382);
20649 rtl8168_mdio_write(tp, 0x14, 0x44f7);
20650 rtl8168_mdio_write(tp, 0x14, 0x3de7);
20651 rtl8168_mdio_write(tp, 0x14, 0x8244);
20652 rtl8168_mdio_write(tp, 0x14, 0x0212);
20653 rtl8168_mdio_write(tp, 0x14, 0xf0ad);
20654 rtl8168_mdio_write(tp, 0x14, 0x223f);
20655 rtl8168_mdio_write(tp, 0x14, 0xe085);
20656 rtl8168_mdio_write(tp, 0x14, 0xf8e4);
20657 rtl8168_mdio_write(tp, 0x14, 0x8288);
20658 rtl8168_mdio_write(tp, 0x14, 0xe085);
20659 rtl8168_mdio_write(tp, 0x14, 0xfce4);
20660 rtl8168_mdio_write(tp, 0x14, 0x8289);
20661 rtl8168_mdio_write(tp, 0x14, 0xe082);
20662 rtl8168_mdio_write(tp, 0x14, 0x440d);
20663 rtl8168_mdio_write(tp, 0x14, 0x0658);
20664 rtl8168_mdio_write(tp, 0x14, 0x01bf);
20665 rtl8168_mdio_write(tp, 0x14, 0x8272);
20666 rtl8168_mdio_write(tp, 0x14, 0x0215);
20667 rtl8168_mdio_write(tp, 0x14, 0x38bf);
20668 rtl8168_mdio_write(tp, 0x14, 0x8250);
20669 rtl8168_mdio_write(tp, 0x14, 0x0213);
20670 rtl8168_mdio_write(tp, 0x14, 0x06a0);
20671 rtl8168_mdio_write(tp, 0x14, 0x010f);
20672 rtl8168_mdio_write(tp, 0x14, 0xe082);
20673 rtl8168_mdio_write(tp, 0x14, 0x44f6);
20674 rtl8168_mdio_write(tp, 0x14, 0x22e4);
20675 rtl8168_mdio_write(tp, 0x14, 0x8244);
20676 rtl8168_mdio_write(tp, 0x14, 0x580f);
20677 rtl8168_mdio_write(tp, 0x14, 0xe582);
20678 rtl8168_mdio_write(tp, 0x14, 0x5cae);
20679 rtl8168_mdio_write(tp, 0x14, 0x0ebf);
20680 rtl8168_mdio_write(tp, 0x14, 0x826c);
20681 rtl8168_mdio_write(tp, 0x14, 0xe382);
20682 rtl8168_mdio_write(tp, 0x14, 0x44f7);
20683 rtl8168_mdio_write(tp, 0x14, 0x3ee7);
20684 rtl8168_mdio_write(tp, 0x14, 0x8244);
20685 rtl8168_mdio_write(tp, 0x14, 0x0212);
20686 rtl8168_mdio_write(tp, 0x14, 0xf0ad);
20687 rtl8168_mdio_write(tp, 0x14, 0x233f);
20688 rtl8168_mdio_write(tp, 0x14, 0xe085);
20689 rtl8168_mdio_write(tp, 0x14, 0xf9e4);
20690 rtl8168_mdio_write(tp, 0x14, 0x8288);
20691 rtl8168_mdio_write(tp, 0x14, 0xe085);
20692 rtl8168_mdio_write(tp, 0x14, 0xfde4);
20693 rtl8168_mdio_write(tp, 0x14, 0x8289);
20694 rtl8168_mdio_write(tp, 0x14, 0xe082);
20695 rtl8168_mdio_write(tp, 0x14, 0x440d);
20696 rtl8168_mdio_write(tp, 0x14, 0x0758);
20697 rtl8168_mdio_write(tp, 0x14, 0x01bf);
20698 rtl8168_mdio_write(tp, 0x14, 0x8279);
20699 rtl8168_mdio_write(tp, 0x14, 0x0215);
20700 rtl8168_mdio_write(tp, 0x14, 0x38bf);
20701 rtl8168_mdio_write(tp, 0x14, 0x8251);
20702 rtl8168_mdio_write(tp, 0x14, 0x0213);
20703 rtl8168_mdio_write(tp, 0x14, 0x06a0);
20704 rtl8168_mdio_write(tp, 0x14, 0x010f);
20705 rtl8168_mdio_write(tp, 0x14, 0xe082);
20706 rtl8168_mdio_write(tp, 0x14, 0x44f6);
20707 rtl8168_mdio_write(tp, 0x14, 0x23e4);
20708 rtl8168_mdio_write(tp, 0x14, 0x8244);
20709 rtl8168_mdio_write(tp, 0x14, 0x580f);
20710 rtl8168_mdio_write(tp, 0x14, 0xe582);
20711 rtl8168_mdio_write(tp, 0x14, 0x5dae);
20712 rtl8168_mdio_write(tp, 0x14, 0x0ebf);
20713 rtl8168_mdio_write(tp, 0x14, 0x8273);
20714 rtl8168_mdio_write(tp, 0x14, 0xe382);
20715 rtl8168_mdio_write(tp, 0x14, 0x44f7);
20716 rtl8168_mdio_write(tp, 0x14, 0x3fe7);
20717 rtl8168_mdio_write(tp, 0x14, 0x8244);
20718 rtl8168_mdio_write(tp, 0x14, 0x0212);
20719 rtl8168_mdio_write(tp, 0x14, 0xf0ee);
20720 rtl8168_mdio_write(tp, 0x14, 0x8288);
20721 rtl8168_mdio_write(tp, 0x14, 0x10ee);
20722 rtl8168_mdio_write(tp, 0x14, 0x8289);
20723 rtl8168_mdio_write(tp, 0x14, 0x00af);
20724 rtl8168_mdio_write(tp, 0x14, 0x14aa);
20725 rtl8168_mdio_write(tp, 0x13, 0xb818);
20726 rtl8168_mdio_write(tp, 0x14, 0x13cf);
20727 rtl8168_mdio_write(tp, 0x13, 0xb81a);
20728 rtl8168_mdio_write(tp, 0x14, 0xfffd);
20729 rtl8168_mdio_write(tp, 0x13, 0xb81c);
20730 rtl8168_mdio_write(tp, 0x14, 0xfffd);
20731 rtl8168_mdio_write(tp, 0x13, 0xb81e);
20732 rtl8168_mdio_write(tp, 0x14, 0xfffd);
20733 rtl8168_mdio_write(tp, 0x13, 0xb832);
20734 rtl8168_mdio_write(tp, 0x14, 0x0001);
20735
20736
20737 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20738 rtl8168_mdio_write(tp, 0x13, 0x0000);
20739 rtl8168_mdio_write(tp, 0x14, 0x0000);
20740 rtl8168_mdio_write(tp, 0x1f, 0x0B82);
20741 gphy_val = rtl8168_mdio_read(tp, 0x17);
20742 gphy_val &= ~(BIT_0);
20743 rtl8168_mdio_write(tp, 0x17, gphy_val);
20744 rtl8168_mdio_write(tp, 0x1f, 0x0A43);
20745 rtl8168_mdio_write(tp, 0x13, 0x8028);
20746 rtl8168_mdio_write(tp, 0x14, 0x0000);
20747
20748 rtl8168_clear_phy_mcu_patch_request(tp);
20749
20750 if (tp->RequiredSecLanDonglePatch) {
20751 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
20752 gphy_val = rtl8168_mdio_read(tp, 0x11);
20753 gphy_val &= ~BIT_6;
20754 rtl8168_mdio_write(tp, 0x11, gphy_val);
20755 }
20756 }
20757
20758 static void
rtl8168_init_hw_phy_mcu(struct net_device * dev)20759 rtl8168_init_hw_phy_mcu(struct net_device *dev)
20760 {
20761 struct rtl8168_private *tp = netdev_priv(dev);
20762 u8 require_disable_phy_disable_mode = FALSE;
20763
20764 if (tp->NotWrRamCodeToMicroP == TRUE) return;
20765 if (rtl8168_check_hw_phy_mcu_code_ver(dev)) return;
20766
20767 if (FALSE == rtl8168_phy_ram_code_check(dev)) {
20768 rtl8168_set_phy_ram_code_check_fail_flag(dev);
20769 return;
20770 }
20771
20772 if (HW_SUPPORT_CHECK_PHY_DISABLE_MODE(tp) && rtl8168_is_in_phy_disable_mode(dev))
20773 require_disable_phy_disable_mode = TRUE;
20774
20775 if (require_disable_phy_disable_mode)
20776 rtl8168_disable_phy_disable_mode(dev);
20777
20778 switch (tp->mcfg) {
20779 case CFG_METHOD_14:
20780 rtl8168_set_phy_mcu_8168e_1(dev);
20781 break;
20782 case CFG_METHOD_15:
20783 rtl8168_set_phy_mcu_8168e_2(dev);
20784 break;
20785 case CFG_METHOD_16:
20786 rtl8168_set_phy_mcu_8168evl_1(dev);
20787 break;
20788 case CFG_METHOD_17:
20789 rtl8168_set_phy_mcu_8168evl_2(dev);
20790 break;
20791 case CFG_METHOD_18:
20792 rtl8168_set_phy_mcu_8168f_1(dev);
20793 break;
20794 case CFG_METHOD_19:
20795 rtl8168_set_phy_mcu_8168f_2(dev);
20796 break;
20797 case CFG_METHOD_20:
20798 rtl8168_set_phy_mcu_8411_1(dev);
20799 break;
20800 case CFG_METHOD_21:
20801 rtl8168_set_phy_mcu_8168g_1(dev);
20802 break;
20803 case CFG_METHOD_25:
20804 rtl8168_set_phy_mcu_8168gu_2(dev);
20805 break;
20806 case CFG_METHOD_26:
20807 rtl8168_set_phy_mcu_8411b_1(dev);
20808 break;
20809 case CFG_METHOD_28:
20810 rtl8168_set_phy_mcu_8168ep_2(dev);
20811 break;
20812 case CFG_METHOD_29:
20813 rtl8168_set_phy_mcu_8168h_1(dev);
20814 break;
20815 case CFG_METHOD_30:
20816 rtl8168_set_phy_mcu_8168h_2(dev);
20817 break;
20818 }
20819
20820 if (require_disable_phy_disable_mode)
20821 rtl8168_enable_phy_disable_mode(dev);
20822
20823 rtl8168_write_hw_phy_mcu_code_ver(dev);
20824
20825 rtl8168_mdio_write(tp,0x1F, 0x0000);
20826
20827 tp->HwHasWrRamCodeToMicroP = TRUE;
20828 }
20829 #endif
20830
20831 static void
rtl8168_hw_phy_config(struct net_device * dev)20832 rtl8168_hw_phy_config(struct net_device *dev)
20833 {
20834 struct rtl8168_private *tp = netdev_priv(dev);
20835 struct pci_dev *pdev = tp->pci_dev;
20836 u16 gphy_val;
20837 unsigned int i;
20838
20839 tp->phy_reset_enable(dev);
20840
20841 if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) return;
20842
20843 #ifndef ENABLE_USE_FIRMWARE_FILE
20844 if (!tp->rtl_fw) {
20845 rtl8168_init_hw_phy_mcu(dev);
20846 }
20847 #endif
20848
20849 if (tp->mcfg == CFG_METHOD_1) {
20850 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20851 rtl8168_mdio_write(tp, 0x0B, 0x94B0);
20852
20853 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20854 rtl8168_mdio_write(tp, 0x12, 0x6096);
20855 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20856
20857 rtl8168_mdio_write(tp, 0x0D, 0xF8A0);
20858 } else if (tp->mcfg == CFG_METHOD_2) {
20859 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20860 rtl8168_mdio_write(tp, 0x0B, 0x94B0);
20861
20862 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20863 rtl8168_mdio_write(tp, 0x12, 0x6096);
20864
20865 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20866 } else if (tp->mcfg == CFG_METHOD_3) {
20867 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20868 rtl8168_mdio_write(tp, 0x0B, 0x94B0);
20869
20870 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20871 rtl8168_mdio_write(tp, 0x12, 0x6096);
20872
20873 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20874 } else if (tp->mcfg == CFG_METHOD_4) {
20875 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20876 rtl8168_mdio_write(tp, 0x12, 0x2300);
20877 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20878 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20879 rtl8168_mdio_write(tp, 0x16, 0x000A);
20880 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20881
20882 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20883 rtl8168_mdio_write(tp, 0x12, 0xC096);
20884 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20885
20886 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20887 rtl8168_mdio_write(tp, 0x00, 0x88DE);
20888 rtl8168_mdio_write(tp, 0x01, 0x82B1);
20889 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20890
20891 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20892 rtl8168_mdio_write(tp, 0x08, 0x9E30);
20893 rtl8168_mdio_write(tp, 0x09, 0x01F0);
20894 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20895
20896 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20897 rtl8168_mdio_write(tp, 0x0A, 0x5500);
20898 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20899
20900 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20901 rtl8168_mdio_write(tp, 0x03, 0x7002);
20902 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20903
20904 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20905 rtl8168_mdio_write(tp, 0x0C, 0x00C8);
20906 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20907
20908 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20909 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | (1 << 5));
20910 rtl8168_mdio_write(tp, 0x0D, rtl8168_mdio_read(tp, 0x0D) & ~(1 << 5));
20911 } else if (tp->mcfg == CFG_METHOD_5) {
20912 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20913 rtl8168_mdio_write(tp, 0x12, 0x2300);
20914 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20915 rtl8168_mdio_write(tp, 0x16, 0x0F0A);
20916 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20917
20918 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20919 rtl8168_mdio_write(tp, 0x00, 0x88DE);
20920 rtl8168_mdio_write(tp, 0x01, 0x82B1);
20921 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20922
20923 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20924 rtl8168_mdio_write(tp, 0x0C, 0x7EB8);
20925 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20926
20927 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20928 rtl8168_mdio_write(tp, 0x06, 0x0761);
20929 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20930
20931 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20932 rtl8168_mdio_write(tp, 0x03, 0x802F);
20933 rtl8168_mdio_write(tp, 0x02, 0x4F02);
20934 rtl8168_mdio_write(tp, 0x01, 0x0409);
20935 rtl8168_mdio_write(tp, 0x00, 0xF099);
20936 rtl8168_mdio_write(tp, 0x04, 0x9800);
20937 rtl8168_mdio_write(tp, 0x04, 0x9000);
20938 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20939
20940 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20941 rtl8168_mdio_write(tp, 0x16, rtl8168_mdio_read(tp, 0x16) | (1 << 0));
20942
20943 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20944 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | (1 << 5));
20945 rtl8168_mdio_write(tp, 0x0D, rtl8168_mdio_read(tp, 0x0D) & ~(1 << 5));
20946
20947 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20948 rtl8168_mdio_write(tp, 0x1D, 0x3D98);
20949 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20950
20951 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20952 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
20953 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20954 } else if (tp->mcfg == CFG_METHOD_6) {
20955 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20956 rtl8168_mdio_write(tp, 0x12, 0x2300);
20957 rtl8168_mdio_write(tp, 0x1F, 0x0003);
20958 rtl8168_mdio_write(tp, 0x16, 0x0F0A);
20959 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20960
20961 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20962 rtl8168_mdio_write(tp, 0x00, 0x88DE);
20963 rtl8168_mdio_write(tp, 0x01, 0x82B1);
20964 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20965
20966 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20967 rtl8168_mdio_write(tp, 0x0C, 0x7EB8);
20968 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20969
20970 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20971 rtl8168_mdio_write(tp, 0x06, 0x5461);
20972 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20973
20974 rtl8168_mdio_write(tp, 0x1F, 0x0002);
20975 rtl8168_mdio_write(tp, 0x06, 0x5461);
20976 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20977
20978 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20979 rtl8168_mdio_write(tp, 0x16, rtl8168_mdio_read(tp, 0x16) | (1 << 0));
20980
20981 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20982 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | (1 << 5));
20983 rtl8168_mdio_write(tp, 0x0D, rtl8168_mdio_read(tp, 0x0D) & ~(1 << 5));
20984
20985 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20986 rtl8168_mdio_write(tp, 0x1D, 0x3D98);
20987 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20988
20989 rtl8168_mdio_write(tp, 0x1f, 0x0001);
20990 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
20991 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20992 } else if (tp->mcfg == CFG_METHOD_7) {
20993 rtl8168_mdio_write(tp, 0x1F, 0x0000);
20994 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | (1 << 5));
20995 rtl8168_mdio_write(tp, 0x0D, rtl8168_mdio_read(tp, 0x0D) & ~(1 << 5));
20996
20997 rtl8168_mdio_write(tp, 0x1F, 0x0001);
20998 rtl8168_mdio_write(tp, 0x1D, 0x3D98);
20999
21000 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21001 rtl8168_mdio_write(tp, 0x14, 0xCAA3);
21002 rtl8168_mdio_write(tp, 0x1C, 0x000A);
21003 rtl8168_mdio_write(tp, 0x18, 0x65D0);
21004
21005 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21006 rtl8168_mdio_write(tp, 0x17, 0xB580);
21007 rtl8168_mdio_write(tp, 0x18, 0xFF54);
21008 rtl8168_mdio_write(tp, 0x19, 0x3954);
21009
21010 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21011 rtl8168_mdio_write(tp, 0x0D, 0x310C);
21012 rtl8168_mdio_write(tp, 0x0E, 0x310C);
21013 rtl8168_mdio_write(tp, 0x0F, 0x311C);
21014 rtl8168_mdio_write(tp, 0x06, 0x0761);
21015
21016 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21017 rtl8168_mdio_write(tp, 0x18, 0xFF55);
21018 rtl8168_mdio_write(tp, 0x19, 0x3955);
21019 rtl8168_mdio_write(tp, 0x18, 0xFF54);
21020 rtl8168_mdio_write(tp, 0x19, 0x3954);
21021
21022 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21023 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
21024
21025 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21026 } else if (tp->mcfg == CFG_METHOD_8) {
21027 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21028 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | (1 << 5));
21029 rtl8168_mdio_write(tp, 0x0D, rtl8168_mdio_read(tp, 0x0D) & ~(1 << 5));
21030
21031 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21032 rtl8168_mdio_write(tp, 0x14, 0xCAA3);
21033 rtl8168_mdio_write(tp, 0x1C, 0x000A);
21034 rtl8168_mdio_write(tp, 0x18, 0x65D0);
21035
21036 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21037 rtl8168_mdio_write(tp, 0x17, 0xB580);
21038 rtl8168_mdio_write(tp, 0x18, 0xFF54);
21039 rtl8168_mdio_write(tp, 0x19, 0x3954);
21040
21041 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21042 rtl8168_mdio_write(tp, 0x0D, 0x310C);
21043 rtl8168_mdio_write(tp, 0x0E, 0x310C);
21044 rtl8168_mdio_write(tp, 0x0F, 0x311C);
21045 rtl8168_mdio_write(tp, 0x06, 0x0761);
21046
21047 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21048 rtl8168_mdio_write(tp, 0x18, 0xFF55);
21049 rtl8168_mdio_write(tp, 0x19, 0x3955);
21050 rtl8168_mdio_write(tp, 0x18, 0xFF54);
21051 rtl8168_mdio_write(tp, 0x19, 0x3954);
21052
21053 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21054 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
21055
21056 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21057 rtl8168_mdio_write(tp, 0x16, rtl8168_mdio_read(tp, 0x16) | (1 << 0));
21058
21059 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21060 } else if (tp->mcfg == CFG_METHOD_9) {
21061 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21062 rtl8168_mdio_write(tp, 0x06, 0x4064);
21063 rtl8168_mdio_write(tp, 0x07, 0x2863);
21064 rtl8168_mdio_write(tp, 0x08, 0x059C);
21065 rtl8168_mdio_write(tp, 0x09, 0x26B4);
21066 rtl8168_mdio_write(tp, 0x0A, 0x6A19);
21067 rtl8168_mdio_write(tp, 0x0B, 0xDCC8);
21068 rtl8168_mdio_write(tp, 0x10, 0xF06D);
21069 rtl8168_mdio_write(tp, 0x14, 0x7F68);
21070 rtl8168_mdio_write(tp, 0x18, 0x7FD9);
21071 rtl8168_mdio_write(tp, 0x1C, 0xF0FF);
21072 rtl8168_mdio_write(tp, 0x1D, 0x3D9C);
21073 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21074 rtl8168_mdio_write(tp, 0x12, 0xF49F);
21075 rtl8168_mdio_write(tp, 0x13, 0x070B);
21076 rtl8168_mdio_write(tp, 0x1A, 0x05AD);
21077 rtl8168_mdio_write(tp, 0x14, 0x94C0);
21078
21079 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21080 gphy_val = rtl8168_mdio_read(tp, 0x0B) & 0xFF00;
21081 gphy_val |= 0x10;
21082 rtl8168_mdio_write(tp, 0x0B, gphy_val);
21083 gphy_val = rtl8168_mdio_read(tp, 0x0C) & 0x00FF;
21084 gphy_val |= 0xA200;
21085 rtl8168_mdio_write(tp, 0x0C, gphy_val);
21086
21087 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21088 rtl8168_mdio_write(tp, 0x06, 0x5561);
21089 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21090 rtl8168_mdio_write(tp, 0x05, 0x8332);
21091 rtl8168_mdio_write(tp, 0x06, 0x5561);
21092
21093 if (rtl8168_efuse_read(tp, 0x01) == 0xb1) {
21094 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21095 rtl8168_mdio_write(tp, 0x05, 0x669A);
21096 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21097 rtl8168_mdio_write(tp, 0x05, 0x8330);
21098 rtl8168_mdio_write(tp, 0x06, 0x669A);
21099
21100 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21101 gphy_val = rtl8168_mdio_read(tp, 0x0D);
21102 if ((gphy_val & 0x00FF) != 0x006C) {
21103 gphy_val &= 0xFF00;
21104 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21105 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0065);
21106 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0066);
21107 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0067);
21108 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0068);
21109 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0069);
21110 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x006A);
21111 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x006B);
21112 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x006C);
21113 }
21114 } else {
21115 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21116 rtl8168_mdio_write(tp, 0x05, 0x6662);
21117 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21118 rtl8168_mdio_write(tp, 0x05, 0x8330);
21119 rtl8168_mdio_write(tp, 0x06, 0x6662);
21120 }
21121
21122 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21123 gphy_val = rtl8168_mdio_read(tp, 0x0D);
21124 gphy_val |= BIT_9;
21125 gphy_val |= BIT_8;
21126 rtl8168_mdio_write(tp, 0x0D, gphy_val);
21127 gphy_val = rtl8168_mdio_read(tp, 0x0F);
21128 gphy_val |= BIT_4;
21129 rtl8168_mdio_write(tp, 0x0F, gphy_val);
21130
21131 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21132 gphy_val = rtl8168_mdio_read(tp, 0x02);
21133 gphy_val &= ~BIT_10;
21134 gphy_val &= ~BIT_9;
21135 gphy_val |= BIT_8;
21136 rtl8168_mdio_write(tp, 0x02, gphy_val);
21137 gphy_val = rtl8168_mdio_read(tp, 0x03);
21138 gphy_val &= ~BIT_15;
21139 gphy_val &= ~BIT_14;
21140 gphy_val &= ~BIT_13;
21141 rtl8168_mdio_write(tp, 0x03, gphy_val);
21142
21143 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21144 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
21145
21146 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21147 rtl8168_mdio_write(tp, 0x05, 0x001B);
21148 if (rtl8168_mdio_read(tp, 0x06) == 0xBF00) {
21149 rtl8168_mdio_write(tp, 0x1f, 0x0005);
21150 rtl8168_mdio_write(tp, 0x05, 0xfff6);
21151 rtl8168_mdio_write(tp, 0x06, 0x0080);
21152 rtl8168_mdio_write(tp, 0x05, 0x8000);
21153 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
21154 rtl8168_mdio_write(tp, 0x06, 0xfaef);
21155 rtl8168_mdio_write(tp, 0x06, 0x59ee);
21156 rtl8168_mdio_write(tp, 0x06, 0xf8ea);
21157 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21158 rtl8168_mdio_write(tp, 0x06, 0xf8eb);
21159 rtl8168_mdio_write(tp, 0x06, 0x00e0);
21160 rtl8168_mdio_write(tp, 0x06, 0xf87c);
21161 rtl8168_mdio_write(tp, 0x06, 0xe1f8);
21162 rtl8168_mdio_write(tp, 0x06, 0x7d59);
21163 rtl8168_mdio_write(tp, 0x06, 0x0fef);
21164 rtl8168_mdio_write(tp, 0x06, 0x0139);
21165 rtl8168_mdio_write(tp, 0x06, 0x029e);
21166 rtl8168_mdio_write(tp, 0x06, 0x06ef);
21167 rtl8168_mdio_write(tp, 0x06, 0x1039);
21168 rtl8168_mdio_write(tp, 0x06, 0x089f);
21169 rtl8168_mdio_write(tp, 0x06, 0x2aee);
21170 rtl8168_mdio_write(tp, 0x06, 0xf8ea);
21171 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21172 rtl8168_mdio_write(tp, 0x06, 0xf8eb);
21173 rtl8168_mdio_write(tp, 0x06, 0x01e0);
21174 rtl8168_mdio_write(tp, 0x06, 0xf87c);
21175 rtl8168_mdio_write(tp, 0x06, 0xe1f8);
21176 rtl8168_mdio_write(tp, 0x06, 0x7d58);
21177 rtl8168_mdio_write(tp, 0x06, 0x409e);
21178 rtl8168_mdio_write(tp, 0x06, 0x0f39);
21179 rtl8168_mdio_write(tp, 0x06, 0x46aa);
21180 rtl8168_mdio_write(tp, 0x06, 0x0bbf);
21181 rtl8168_mdio_write(tp, 0x06, 0x8290);
21182 rtl8168_mdio_write(tp, 0x06, 0xd682);
21183 rtl8168_mdio_write(tp, 0x06, 0x9802);
21184 rtl8168_mdio_write(tp, 0x06, 0x014f);
21185 rtl8168_mdio_write(tp, 0x06, 0xae09);
21186 rtl8168_mdio_write(tp, 0x06, 0xbf82);
21187 rtl8168_mdio_write(tp, 0x06, 0x98d6);
21188 rtl8168_mdio_write(tp, 0x06, 0x82a0);
21189 rtl8168_mdio_write(tp, 0x06, 0x0201);
21190 rtl8168_mdio_write(tp, 0x06, 0x4fef);
21191 rtl8168_mdio_write(tp, 0x06, 0x95fe);
21192 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
21193 rtl8168_mdio_write(tp, 0x06, 0x05f8);
21194 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
21195 rtl8168_mdio_write(tp, 0x06, 0xeef8);
21196 rtl8168_mdio_write(tp, 0x06, 0xea00);
21197 rtl8168_mdio_write(tp, 0x06, 0xeef8);
21198 rtl8168_mdio_write(tp, 0x06, 0xeb00);
21199 rtl8168_mdio_write(tp, 0x06, 0xe2f8);
21200 rtl8168_mdio_write(tp, 0x06, 0x7ce3);
21201 rtl8168_mdio_write(tp, 0x06, 0xf87d);
21202 rtl8168_mdio_write(tp, 0x06, 0xa511);
21203 rtl8168_mdio_write(tp, 0x06, 0x1112);
21204 rtl8168_mdio_write(tp, 0x06, 0xd240);
21205 rtl8168_mdio_write(tp, 0x06, 0xd644);
21206 rtl8168_mdio_write(tp, 0x06, 0x4402);
21207 rtl8168_mdio_write(tp, 0x06, 0x8217);
21208 rtl8168_mdio_write(tp, 0x06, 0xd2a0);
21209 rtl8168_mdio_write(tp, 0x06, 0xd6aa);
21210 rtl8168_mdio_write(tp, 0x06, 0xaa02);
21211 rtl8168_mdio_write(tp, 0x06, 0x8217);
21212 rtl8168_mdio_write(tp, 0x06, 0xae0f);
21213 rtl8168_mdio_write(tp, 0x06, 0xa544);
21214 rtl8168_mdio_write(tp, 0x06, 0x4402);
21215 rtl8168_mdio_write(tp, 0x06, 0xae4d);
21216 rtl8168_mdio_write(tp, 0x06, 0xa5aa);
21217 rtl8168_mdio_write(tp, 0x06, 0xaa02);
21218 rtl8168_mdio_write(tp, 0x06, 0xae47);
21219 rtl8168_mdio_write(tp, 0x06, 0xaf82);
21220 rtl8168_mdio_write(tp, 0x06, 0x13ee);
21221 rtl8168_mdio_write(tp, 0x06, 0x834e);
21222 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21223 rtl8168_mdio_write(tp, 0x06, 0x834d);
21224 rtl8168_mdio_write(tp, 0x06, 0x0fee);
21225 rtl8168_mdio_write(tp, 0x06, 0x834c);
21226 rtl8168_mdio_write(tp, 0x06, 0x0fee);
21227 rtl8168_mdio_write(tp, 0x06, 0x834f);
21228 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21229 rtl8168_mdio_write(tp, 0x06, 0x8351);
21230 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21231 rtl8168_mdio_write(tp, 0x06, 0x834a);
21232 rtl8168_mdio_write(tp, 0x06, 0xffee);
21233 rtl8168_mdio_write(tp, 0x06, 0x834b);
21234 rtl8168_mdio_write(tp, 0x06, 0xffe0);
21235 rtl8168_mdio_write(tp, 0x06, 0x8330);
21236 rtl8168_mdio_write(tp, 0x06, 0xe183);
21237 rtl8168_mdio_write(tp, 0x06, 0x3158);
21238 rtl8168_mdio_write(tp, 0x06, 0xfee4);
21239 rtl8168_mdio_write(tp, 0x06, 0xf88a);
21240 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21241 rtl8168_mdio_write(tp, 0x06, 0x8be0);
21242 rtl8168_mdio_write(tp, 0x06, 0x8332);
21243 rtl8168_mdio_write(tp, 0x06, 0xe183);
21244 rtl8168_mdio_write(tp, 0x06, 0x3359);
21245 rtl8168_mdio_write(tp, 0x06, 0x0fe2);
21246 rtl8168_mdio_write(tp, 0x06, 0x834d);
21247 rtl8168_mdio_write(tp, 0x06, 0x0c24);
21248 rtl8168_mdio_write(tp, 0x06, 0x5af0);
21249 rtl8168_mdio_write(tp, 0x06, 0x1e12);
21250 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21251 rtl8168_mdio_write(tp, 0x06, 0x8ce5);
21252 rtl8168_mdio_write(tp, 0x06, 0xf88d);
21253 rtl8168_mdio_write(tp, 0x06, 0xaf82);
21254 rtl8168_mdio_write(tp, 0x06, 0x13e0);
21255 rtl8168_mdio_write(tp, 0x06, 0x834f);
21256 rtl8168_mdio_write(tp, 0x06, 0x10e4);
21257 rtl8168_mdio_write(tp, 0x06, 0x834f);
21258 rtl8168_mdio_write(tp, 0x06, 0xe083);
21259 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21260 rtl8168_mdio_write(tp, 0x06, 0x009f);
21261 rtl8168_mdio_write(tp, 0x06, 0x0ae0);
21262 rtl8168_mdio_write(tp, 0x06, 0x834f);
21263 rtl8168_mdio_write(tp, 0x06, 0xa010);
21264 rtl8168_mdio_write(tp, 0x06, 0xa5ee);
21265 rtl8168_mdio_write(tp, 0x06, 0x834e);
21266 rtl8168_mdio_write(tp, 0x06, 0x01e0);
21267 rtl8168_mdio_write(tp, 0x06, 0x834e);
21268 rtl8168_mdio_write(tp, 0x06, 0x7805);
21269 rtl8168_mdio_write(tp, 0x06, 0x9e9a);
21270 rtl8168_mdio_write(tp, 0x06, 0xe083);
21271 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21272 rtl8168_mdio_write(tp, 0x06, 0x049e);
21273 rtl8168_mdio_write(tp, 0x06, 0x10e0);
21274 rtl8168_mdio_write(tp, 0x06, 0x834e);
21275 rtl8168_mdio_write(tp, 0x06, 0x7803);
21276 rtl8168_mdio_write(tp, 0x06, 0x9e0f);
21277 rtl8168_mdio_write(tp, 0x06, 0xe083);
21278 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21279 rtl8168_mdio_write(tp, 0x06, 0x019e);
21280 rtl8168_mdio_write(tp, 0x06, 0x05ae);
21281 rtl8168_mdio_write(tp, 0x06, 0x0caf);
21282 rtl8168_mdio_write(tp, 0x06, 0x81f8);
21283 rtl8168_mdio_write(tp, 0x06, 0xaf81);
21284 rtl8168_mdio_write(tp, 0x06, 0xa3af);
21285 rtl8168_mdio_write(tp, 0x06, 0x81dc);
21286 rtl8168_mdio_write(tp, 0x06, 0xaf82);
21287 rtl8168_mdio_write(tp, 0x06, 0x13ee);
21288 rtl8168_mdio_write(tp, 0x06, 0x8348);
21289 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21290 rtl8168_mdio_write(tp, 0x06, 0x8349);
21291 rtl8168_mdio_write(tp, 0x06, 0x00e0);
21292 rtl8168_mdio_write(tp, 0x06, 0x8351);
21293 rtl8168_mdio_write(tp, 0x06, 0x10e4);
21294 rtl8168_mdio_write(tp, 0x06, 0x8351);
21295 rtl8168_mdio_write(tp, 0x06, 0x5801);
21296 rtl8168_mdio_write(tp, 0x06, 0x9fea);
21297 rtl8168_mdio_write(tp, 0x06, 0xd000);
21298 rtl8168_mdio_write(tp, 0x06, 0xd180);
21299 rtl8168_mdio_write(tp, 0x06, 0x1f66);
21300 rtl8168_mdio_write(tp, 0x06, 0xe2f8);
21301 rtl8168_mdio_write(tp, 0x06, 0xeae3);
21302 rtl8168_mdio_write(tp, 0x06, 0xf8eb);
21303 rtl8168_mdio_write(tp, 0x06, 0x5af8);
21304 rtl8168_mdio_write(tp, 0x06, 0x1e20);
21305 rtl8168_mdio_write(tp, 0x06, 0xe6f8);
21306 rtl8168_mdio_write(tp, 0x06, 0xeae5);
21307 rtl8168_mdio_write(tp, 0x06, 0xf8eb);
21308 rtl8168_mdio_write(tp, 0x06, 0xd302);
21309 rtl8168_mdio_write(tp, 0x06, 0xb3fe);
21310 rtl8168_mdio_write(tp, 0x06, 0xe2f8);
21311 rtl8168_mdio_write(tp, 0x06, 0x7cef);
21312 rtl8168_mdio_write(tp, 0x06, 0x325b);
21313 rtl8168_mdio_write(tp, 0x06, 0x80e3);
21314 rtl8168_mdio_write(tp, 0x06, 0xf87d);
21315 rtl8168_mdio_write(tp, 0x06, 0x9e03);
21316 rtl8168_mdio_write(tp, 0x06, 0x7dff);
21317 rtl8168_mdio_write(tp, 0x06, 0xff0d);
21318 rtl8168_mdio_write(tp, 0x06, 0x581c);
21319 rtl8168_mdio_write(tp, 0x06, 0x551a);
21320 rtl8168_mdio_write(tp, 0x06, 0x6511);
21321 rtl8168_mdio_write(tp, 0x06, 0xa190);
21322 rtl8168_mdio_write(tp, 0x06, 0xd3e2);
21323 rtl8168_mdio_write(tp, 0x06, 0x8348);
21324 rtl8168_mdio_write(tp, 0x06, 0xe383);
21325 rtl8168_mdio_write(tp, 0x06, 0x491b);
21326 rtl8168_mdio_write(tp, 0x06, 0x56ab);
21327 rtl8168_mdio_write(tp, 0x06, 0x08ef);
21328 rtl8168_mdio_write(tp, 0x06, 0x56e6);
21329 rtl8168_mdio_write(tp, 0x06, 0x8348);
21330 rtl8168_mdio_write(tp, 0x06, 0xe783);
21331 rtl8168_mdio_write(tp, 0x06, 0x4910);
21332 rtl8168_mdio_write(tp, 0x06, 0xd180);
21333 rtl8168_mdio_write(tp, 0x06, 0x1f66);
21334 rtl8168_mdio_write(tp, 0x06, 0xa004);
21335 rtl8168_mdio_write(tp, 0x06, 0xb9e2);
21336 rtl8168_mdio_write(tp, 0x06, 0x8348);
21337 rtl8168_mdio_write(tp, 0x06, 0xe383);
21338 rtl8168_mdio_write(tp, 0x06, 0x49ef);
21339 rtl8168_mdio_write(tp, 0x06, 0x65e2);
21340 rtl8168_mdio_write(tp, 0x06, 0x834a);
21341 rtl8168_mdio_write(tp, 0x06, 0xe383);
21342 rtl8168_mdio_write(tp, 0x06, 0x4b1b);
21343 rtl8168_mdio_write(tp, 0x06, 0x56aa);
21344 rtl8168_mdio_write(tp, 0x06, 0x0eef);
21345 rtl8168_mdio_write(tp, 0x06, 0x56e6);
21346 rtl8168_mdio_write(tp, 0x06, 0x834a);
21347 rtl8168_mdio_write(tp, 0x06, 0xe783);
21348 rtl8168_mdio_write(tp, 0x06, 0x4be2);
21349 rtl8168_mdio_write(tp, 0x06, 0x834d);
21350 rtl8168_mdio_write(tp, 0x06, 0xe683);
21351 rtl8168_mdio_write(tp, 0x06, 0x4ce0);
21352 rtl8168_mdio_write(tp, 0x06, 0x834d);
21353 rtl8168_mdio_write(tp, 0x06, 0xa000);
21354 rtl8168_mdio_write(tp, 0x06, 0x0caf);
21355 rtl8168_mdio_write(tp, 0x06, 0x81dc);
21356 rtl8168_mdio_write(tp, 0x06, 0xe083);
21357 rtl8168_mdio_write(tp, 0x06, 0x4d10);
21358 rtl8168_mdio_write(tp, 0x06, 0xe483);
21359 rtl8168_mdio_write(tp, 0x06, 0x4dae);
21360 rtl8168_mdio_write(tp, 0x06, 0x0480);
21361 rtl8168_mdio_write(tp, 0x06, 0xe483);
21362 rtl8168_mdio_write(tp, 0x06, 0x4de0);
21363 rtl8168_mdio_write(tp, 0x06, 0x834e);
21364 rtl8168_mdio_write(tp, 0x06, 0x7803);
21365 rtl8168_mdio_write(tp, 0x06, 0x9e0b);
21366 rtl8168_mdio_write(tp, 0x06, 0xe083);
21367 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21368 rtl8168_mdio_write(tp, 0x06, 0x049e);
21369 rtl8168_mdio_write(tp, 0x06, 0x04ee);
21370 rtl8168_mdio_write(tp, 0x06, 0x834e);
21371 rtl8168_mdio_write(tp, 0x06, 0x02e0);
21372 rtl8168_mdio_write(tp, 0x06, 0x8332);
21373 rtl8168_mdio_write(tp, 0x06, 0xe183);
21374 rtl8168_mdio_write(tp, 0x06, 0x3359);
21375 rtl8168_mdio_write(tp, 0x06, 0x0fe2);
21376 rtl8168_mdio_write(tp, 0x06, 0x834d);
21377 rtl8168_mdio_write(tp, 0x06, 0x0c24);
21378 rtl8168_mdio_write(tp, 0x06, 0x5af0);
21379 rtl8168_mdio_write(tp, 0x06, 0x1e12);
21380 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21381 rtl8168_mdio_write(tp, 0x06, 0x8ce5);
21382 rtl8168_mdio_write(tp, 0x06, 0xf88d);
21383 rtl8168_mdio_write(tp, 0x06, 0xe083);
21384 rtl8168_mdio_write(tp, 0x06, 0x30e1);
21385 rtl8168_mdio_write(tp, 0x06, 0x8331);
21386 rtl8168_mdio_write(tp, 0x06, 0x6801);
21387 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21388 rtl8168_mdio_write(tp, 0x06, 0x8ae5);
21389 rtl8168_mdio_write(tp, 0x06, 0xf88b);
21390 rtl8168_mdio_write(tp, 0x06, 0xae37);
21391 rtl8168_mdio_write(tp, 0x06, 0xee83);
21392 rtl8168_mdio_write(tp, 0x06, 0x4e03);
21393 rtl8168_mdio_write(tp, 0x06, 0xe083);
21394 rtl8168_mdio_write(tp, 0x06, 0x4ce1);
21395 rtl8168_mdio_write(tp, 0x06, 0x834d);
21396 rtl8168_mdio_write(tp, 0x06, 0x1b01);
21397 rtl8168_mdio_write(tp, 0x06, 0x9e04);
21398 rtl8168_mdio_write(tp, 0x06, 0xaaa1);
21399 rtl8168_mdio_write(tp, 0x06, 0xaea8);
21400 rtl8168_mdio_write(tp, 0x06, 0xee83);
21401 rtl8168_mdio_write(tp, 0x06, 0x4e04);
21402 rtl8168_mdio_write(tp, 0x06, 0xee83);
21403 rtl8168_mdio_write(tp, 0x06, 0x4f00);
21404 rtl8168_mdio_write(tp, 0x06, 0xaeab);
21405 rtl8168_mdio_write(tp, 0x06, 0xe083);
21406 rtl8168_mdio_write(tp, 0x06, 0x4f78);
21407 rtl8168_mdio_write(tp, 0x06, 0x039f);
21408 rtl8168_mdio_write(tp, 0x06, 0x14ee);
21409 rtl8168_mdio_write(tp, 0x06, 0x834e);
21410 rtl8168_mdio_write(tp, 0x06, 0x05d2);
21411 rtl8168_mdio_write(tp, 0x06, 0x40d6);
21412 rtl8168_mdio_write(tp, 0x06, 0x5554);
21413 rtl8168_mdio_write(tp, 0x06, 0x0282);
21414 rtl8168_mdio_write(tp, 0x06, 0x17d2);
21415 rtl8168_mdio_write(tp, 0x06, 0xa0d6);
21416 rtl8168_mdio_write(tp, 0x06, 0xba00);
21417 rtl8168_mdio_write(tp, 0x06, 0x0282);
21418 rtl8168_mdio_write(tp, 0x06, 0x17fe);
21419 rtl8168_mdio_write(tp, 0x06, 0xfdfc);
21420 rtl8168_mdio_write(tp, 0x06, 0x05f8);
21421 rtl8168_mdio_write(tp, 0x06, 0xe0f8);
21422 rtl8168_mdio_write(tp, 0x06, 0x60e1);
21423 rtl8168_mdio_write(tp, 0x06, 0xf861);
21424 rtl8168_mdio_write(tp, 0x06, 0x6802);
21425 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21426 rtl8168_mdio_write(tp, 0x06, 0x60e5);
21427 rtl8168_mdio_write(tp, 0x06, 0xf861);
21428 rtl8168_mdio_write(tp, 0x06, 0xe0f8);
21429 rtl8168_mdio_write(tp, 0x06, 0x48e1);
21430 rtl8168_mdio_write(tp, 0x06, 0xf849);
21431 rtl8168_mdio_write(tp, 0x06, 0x580f);
21432 rtl8168_mdio_write(tp, 0x06, 0x1e02);
21433 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21434 rtl8168_mdio_write(tp, 0x06, 0x48e5);
21435 rtl8168_mdio_write(tp, 0x06, 0xf849);
21436 rtl8168_mdio_write(tp, 0x06, 0xd000);
21437 rtl8168_mdio_write(tp, 0x06, 0x0282);
21438 rtl8168_mdio_write(tp, 0x06, 0x5bbf);
21439 rtl8168_mdio_write(tp, 0x06, 0x8350);
21440 rtl8168_mdio_write(tp, 0x06, 0xef46);
21441 rtl8168_mdio_write(tp, 0x06, 0xdc19);
21442 rtl8168_mdio_write(tp, 0x06, 0xddd0);
21443 rtl8168_mdio_write(tp, 0x06, 0x0102);
21444 rtl8168_mdio_write(tp, 0x06, 0x825b);
21445 rtl8168_mdio_write(tp, 0x06, 0x0282);
21446 rtl8168_mdio_write(tp, 0x06, 0x77e0);
21447 rtl8168_mdio_write(tp, 0x06, 0xf860);
21448 rtl8168_mdio_write(tp, 0x06, 0xe1f8);
21449 rtl8168_mdio_write(tp, 0x06, 0x6158);
21450 rtl8168_mdio_write(tp, 0x06, 0xfde4);
21451 rtl8168_mdio_write(tp, 0x06, 0xf860);
21452 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21453 rtl8168_mdio_write(tp, 0x06, 0x61fc);
21454 rtl8168_mdio_write(tp, 0x06, 0x04f9);
21455 rtl8168_mdio_write(tp, 0x06, 0xfafb);
21456 rtl8168_mdio_write(tp, 0x06, 0xc6bf);
21457 rtl8168_mdio_write(tp, 0x06, 0xf840);
21458 rtl8168_mdio_write(tp, 0x06, 0xbe83);
21459 rtl8168_mdio_write(tp, 0x06, 0x50a0);
21460 rtl8168_mdio_write(tp, 0x06, 0x0101);
21461 rtl8168_mdio_write(tp, 0x06, 0x071b);
21462 rtl8168_mdio_write(tp, 0x06, 0x89cf);
21463 rtl8168_mdio_write(tp, 0x06, 0xd208);
21464 rtl8168_mdio_write(tp, 0x06, 0xebdb);
21465 rtl8168_mdio_write(tp, 0x06, 0x19b2);
21466 rtl8168_mdio_write(tp, 0x06, 0xfbff);
21467 rtl8168_mdio_write(tp, 0x06, 0xfefd);
21468 rtl8168_mdio_write(tp, 0x06, 0x04f8);
21469 rtl8168_mdio_write(tp, 0x06, 0xe0f8);
21470 rtl8168_mdio_write(tp, 0x06, 0x48e1);
21471 rtl8168_mdio_write(tp, 0x06, 0xf849);
21472 rtl8168_mdio_write(tp, 0x06, 0x6808);
21473 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21474 rtl8168_mdio_write(tp, 0x06, 0x48e5);
21475 rtl8168_mdio_write(tp, 0x06, 0xf849);
21476 rtl8168_mdio_write(tp, 0x06, 0x58f7);
21477 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21478 rtl8168_mdio_write(tp, 0x06, 0x48e5);
21479 rtl8168_mdio_write(tp, 0x06, 0xf849);
21480 rtl8168_mdio_write(tp, 0x06, 0xfc04);
21481 rtl8168_mdio_write(tp, 0x06, 0x4d20);
21482 rtl8168_mdio_write(tp, 0x06, 0x0002);
21483 rtl8168_mdio_write(tp, 0x06, 0x4e22);
21484 rtl8168_mdio_write(tp, 0x06, 0x0002);
21485 rtl8168_mdio_write(tp, 0x06, 0x4ddf);
21486 rtl8168_mdio_write(tp, 0x06, 0xff01);
21487 rtl8168_mdio_write(tp, 0x06, 0x4edd);
21488 rtl8168_mdio_write(tp, 0x06, 0xff01);
21489 rtl8168_mdio_write(tp, 0x06, 0xf8fa);
21490 rtl8168_mdio_write(tp, 0x06, 0xfbef);
21491 rtl8168_mdio_write(tp, 0x06, 0x79bf);
21492 rtl8168_mdio_write(tp, 0x06, 0xf822);
21493 rtl8168_mdio_write(tp, 0x06, 0xd819);
21494 rtl8168_mdio_write(tp, 0x06, 0xd958);
21495 rtl8168_mdio_write(tp, 0x06, 0x849f);
21496 rtl8168_mdio_write(tp, 0x06, 0x09bf);
21497 rtl8168_mdio_write(tp, 0x06, 0x82be);
21498 rtl8168_mdio_write(tp, 0x06, 0xd682);
21499 rtl8168_mdio_write(tp, 0x06, 0xc602);
21500 rtl8168_mdio_write(tp, 0x06, 0x014f);
21501 rtl8168_mdio_write(tp, 0x06, 0xef97);
21502 rtl8168_mdio_write(tp, 0x06, 0xfffe);
21503 rtl8168_mdio_write(tp, 0x06, 0xfc05);
21504 rtl8168_mdio_write(tp, 0x06, 0x17ff);
21505 rtl8168_mdio_write(tp, 0x06, 0xfe01);
21506 rtl8168_mdio_write(tp, 0x06, 0x1700);
21507 rtl8168_mdio_write(tp, 0x06, 0x0102);
21508 rtl8168_mdio_write(tp, 0x05, 0x83d8);
21509 rtl8168_mdio_write(tp, 0x06, 0x8051);
21510 rtl8168_mdio_write(tp, 0x05, 0x83d6);
21511 rtl8168_mdio_write(tp, 0x06, 0x82a0);
21512 rtl8168_mdio_write(tp, 0x05, 0x83d4);
21513 rtl8168_mdio_write(tp, 0x06, 0x8000);
21514 rtl8168_mdio_write(tp, 0x02, 0x2010);
21515 rtl8168_mdio_write(tp, 0x03, 0xdc00);
21516 rtl8168_mdio_write(tp, 0x1f, 0x0000);
21517 rtl8168_mdio_write(tp, 0x0b, 0x0600);
21518 rtl8168_mdio_write(tp, 0x1f, 0x0005);
21519 rtl8168_mdio_write(tp, 0x05, 0xfff6);
21520 rtl8168_mdio_write(tp, 0x06, 0x00fc);
21521 rtl8168_mdio_write(tp, 0x1f, 0x0000);
21522 }
21523
21524 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21525 rtl8168_mdio_write(tp, 0x0D, 0xF880);
21526 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21527 } else if (tp->mcfg == CFG_METHOD_10) {
21528 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21529 rtl8168_mdio_write(tp, 0x06, 0x4064);
21530 rtl8168_mdio_write(tp, 0x07, 0x2863);
21531 rtl8168_mdio_write(tp, 0x08, 0x059C);
21532 rtl8168_mdio_write(tp, 0x09, 0x26B4);
21533 rtl8168_mdio_write(tp, 0x0A, 0x6A19);
21534 rtl8168_mdio_write(tp, 0x0B, 0xDCC8);
21535 rtl8168_mdio_write(tp, 0x10, 0xF06D);
21536 rtl8168_mdio_write(tp, 0x14, 0x7F68);
21537 rtl8168_mdio_write(tp, 0x18, 0x7FD9);
21538 rtl8168_mdio_write(tp, 0x1C, 0xF0FF);
21539 rtl8168_mdio_write(tp, 0x1D, 0x3D9C);
21540 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21541 rtl8168_mdio_write(tp, 0x12, 0xF49F);
21542 rtl8168_mdio_write(tp, 0x13, 0x070B);
21543 rtl8168_mdio_write(tp, 0x1A, 0x05AD);
21544 rtl8168_mdio_write(tp, 0x14, 0x94C0);
21545
21546 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21547 rtl8168_mdio_write(tp, 0x06, 0x5561);
21548 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21549 rtl8168_mdio_write(tp, 0x05, 0x8332);
21550 rtl8168_mdio_write(tp, 0x06, 0x5561);
21551
21552 if (rtl8168_efuse_read(tp, 0x01) == 0xb1) {
21553 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21554 rtl8168_mdio_write(tp, 0x05, 0x669A);
21555 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21556 rtl8168_mdio_write(tp, 0x05, 0x8330);
21557 rtl8168_mdio_write(tp, 0x06, 0x669A);
21558
21559 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21560 gphy_val = rtl8168_mdio_read(tp, 0x0D);
21561 if ((gphy_val & 0x00FF) != 0x006C) {
21562 gphy_val &= 0xFF00;
21563 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21564 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0065);
21565 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0066);
21566 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0067);
21567 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0068);
21568 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x0069);
21569 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x006A);
21570 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x006B);
21571 rtl8168_mdio_write(tp, 0x0D, gphy_val | 0x006C);
21572 }
21573 } else {
21574 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21575 rtl8168_mdio_write(tp, 0x05, 0x2642);
21576 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21577 rtl8168_mdio_write(tp, 0x05, 0x8330);
21578 rtl8168_mdio_write(tp, 0x06, 0x2642);
21579 }
21580
21581 if (rtl8168_efuse_read(tp, 0x30) == 0x98) {
21582 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21583 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) & ~BIT_1);
21584 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21585 rtl8168_mdio_write(tp, 0x01, rtl8168_mdio_read(tp, 0x01) | BIT_9);
21586 } else if (rtl8168_efuse_read(tp, 0x30) == 0x90) {
21587 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21588 rtl8168_mdio_write(tp, 0x01, rtl8168_mdio_read(tp, 0x01) & ~BIT_9);
21589 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21590 rtl8168_mdio_write(tp, 0x16, 0x5101);
21591 }
21592
21593 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21594 gphy_val = rtl8168_mdio_read(tp, 0x02);
21595 gphy_val &= ~BIT_10;
21596 gphy_val &= ~BIT_9;
21597 gphy_val |= BIT_8;
21598 rtl8168_mdio_write(tp, 0x02, gphy_val);
21599 gphy_val = rtl8168_mdio_read(tp, 0x03);
21600 gphy_val &= ~BIT_15;
21601 gphy_val &= ~BIT_14;
21602 gphy_val &= ~BIT_13;
21603 rtl8168_mdio_write(tp, 0x03, gphy_val);
21604
21605 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21606 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
21607
21608 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21609 gphy_val = rtl8168_mdio_read(tp, 0x0F);
21610 gphy_val |= BIT_4;
21611 gphy_val |= BIT_2;
21612 gphy_val |= BIT_1;
21613 gphy_val |= BIT_0;
21614 rtl8168_mdio_write(tp, 0x0F, gphy_val);
21615
21616 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21617 rtl8168_mdio_write(tp, 0x05, 0x001B);
21618 if (rtl8168_mdio_read(tp, 0x06) == 0xB300) {
21619 rtl8168_mdio_write(tp, 0x1f, 0x0005);
21620 rtl8168_mdio_write(tp, 0x05, 0xfff6);
21621 rtl8168_mdio_write(tp, 0x06, 0x0080);
21622 rtl8168_mdio_write(tp, 0x05, 0x8000);
21623 rtl8168_mdio_write(tp, 0x06, 0xf8f9);
21624 rtl8168_mdio_write(tp, 0x06, 0xfaee);
21625 rtl8168_mdio_write(tp, 0x06, 0xf8ea);
21626 rtl8168_mdio_write(tp, 0x06, 0x00ee);
21627 rtl8168_mdio_write(tp, 0x06, 0xf8eb);
21628 rtl8168_mdio_write(tp, 0x06, 0x00e2);
21629 rtl8168_mdio_write(tp, 0x06, 0xf87c);
21630 rtl8168_mdio_write(tp, 0x06, 0xe3f8);
21631 rtl8168_mdio_write(tp, 0x06, 0x7da5);
21632 rtl8168_mdio_write(tp, 0x06, 0x1111);
21633 rtl8168_mdio_write(tp, 0x06, 0x12d2);
21634 rtl8168_mdio_write(tp, 0x06, 0x40d6);
21635 rtl8168_mdio_write(tp, 0x06, 0x4444);
21636 rtl8168_mdio_write(tp, 0x06, 0x0281);
21637 rtl8168_mdio_write(tp, 0x06, 0xc6d2);
21638 rtl8168_mdio_write(tp, 0x06, 0xa0d6);
21639 rtl8168_mdio_write(tp, 0x06, 0xaaaa);
21640 rtl8168_mdio_write(tp, 0x06, 0x0281);
21641 rtl8168_mdio_write(tp, 0x06, 0xc6ae);
21642 rtl8168_mdio_write(tp, 0x06, 0x0fa5);
21643 rtl8168_mdio_write(tp, 0x06, 0x4444);
21644 rtl8168_mdio_write(tp, 0x06, 0x02ae);
21645 rtl8168_mdio_write(tp, 0x06, 0x4da5);
21646 rtl8168_mdio_write(tp, 0x06, 0xaaaa);
21647 rtl8168_mdio_write(tp, 0x06, 0x02ae);
21648 rtl8168_mdio_write(tp, 0x06, 0x47af);
21649 rtl8168_mdio_write(tp, 0x06, 0x81c2);
21650 rtl8168_mdio_write(tp, 0x06, 0xee83);
21651 rtl8168_mdio_write(tp, 0x06, 0x4e00);
21652 rtl8168_mdio_write(tp, 0x06, 0xee83);
21653 rtl8168_mdio_write(tp, 0x06, 0x4d0f);
21654 rtl8168_mdio_write(tp, 0x06, 0xee83);
21655 rtl8168_mdio_write(tp, 0x06, 0x4c0f);
21656 rtl8168_mdio_write(tp, 0x06, 0xee83);
21657 rtl8168_mdio_write(tp, 0x06, 0x4f00);
21658 rtl8168_mdio_write(tp, 0x06, 0xee83);
21659 rtl8168_mdio_write(tp, 0x06, 0x5100);
21660 rtl8168_mdio_write(tp, 0x06, 0xee83);
21661 rtl8168_mdio_write(tp, 0x06, 0x4aff);
21662 rtl8168_mdio_write(tp, 0x06, 0xee83);
21663 rtl8168_mdio_write(tp, 0x06, 0x4bff);
21664 rtl8168_mdio_write(tp, 0x06, 0xe083);
21665 rtl8168_mdio_write(tp, 0x06, 0x30e1);
21666 rtl8168_mdio_write(tp, 0x06, 0x8331);
21667 rtl8168_mdio_write(tp, 0x06, 0x58fe);
21668 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21669 rtl8168_mdio_write(tp, 0x06, 0x8ae5);
21670 rtl8168_mdio_write(tp, 0x06, 0xf88b);
21671 rtl8168_mdio_write(tp, 0x06, 0xe083);
21672 rtl8168_mdio_write(tp, 0x06, 0x32e1);
21673 rtl8168_mdio_write(tp, 0x06, 0x8333);
21674 rtl8168_mdio_write(tp, 0x06, 0x590f);
21675 rtl8168_mdio_write(tp, 0x06, 0xe283);
21676 rtl8168_mdio_write(tp, 0x06, 0x4d0c);
21677 rtl8168_mdio_write(tp, 0x06, 0x245a);
21678 rtl8168_mdio_write(tp, 0x06, 0xf01e);
21679 rtl8168_mdio_write(tp, 0x06, 0x12e4);
21680 rtl8168_mdio_write(tp, 0x06, 0xf88c);
21681 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21682 rtl8168_mdio_write(tp, 0x06, 0x8daf);
21683 rtl8168_mdio_write(tp, 0x06, 0x81c2);
21684 rtl8168_mdio_write(tp, 0x06, 0xe083);
21685 rtl8168_mdio_write(tp, 0x06, 0x4f10);
21686 rtl8168_mdio_write(tp, 0x06, 0xe483);
21687 rtl8168_mdio_write(tp, 0x06, 0x4fe0);
21688 rtl8168_mdio_write(tp, 0x06, 0x834e);
21689 rtl8168_mdio_write(tp, 0x06, 0x7800);
21690 rtl8168_mdio_write(tp, 0x06, 0x9f0a);
21691 rtl8168_mdio_write(tp, 0x06, 0xe083);
21692 rtl8168_mdio_write(tp, 0x06, 0x4fa0);
21693 rtl8168_mdio_write(tp, 0x06, 0x10a5);
21694 rtl8168_mdio_write(tp, 0x06, 0xee83);
21695 rtl8168_mdio_write(tp, 0x06, 0x4e01);
21696 rtl8168_mdio_write(tp, 0x06, 0xe083);
21697 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21698 rtl8168_mdio_write(tp, 0x06, 0x059e);
21699 rtl8168_mdio_write(tp, 0x06, 0x9ae0);
21700 rtl8168_mdio_write(tp, 0x06, 0x834e);
21701 rtl8168_mdio_write(tp, 0x06, 0x7804);
21702 rtl8168_mdio_write(tp, 0x06, 0x9e10);
21703 rtl8168_mdio_write(tp, 0x06, 0xe083);
21704 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21705 rtl8168_mdio_write(tp, 0x06, 0x039e);
21706 rtl8168_mdio_write(tp, 0x06, 0x0fe0);
21707 rtl8168_mdio_write(tp, 0x06, 0x834e);
21708 rtl8168_mdio_write(tp, 0x06, 0x7801);
21709 rtl8168_mdio_write(tp, 0x06, 0x9e05);
21710 rtl8168_mdio_write(tp, 0x06, 0xae0c);
21711 rtl8168_mdio_write(tp, 0x06, 0xaf81);
21712 rtl8168_mdio_write(tp, 0x06, 0xa7af);
21713 rtl8168_mdio_write(tp, 0x06, 0x8152);
21714 rtl8168_mdio_write(tp, 0x06, 0xaf81);
21715 rtl8168_mdio_write(tp, 0x06, 0x8baf);
21716 rtl8168_mdio_write(tp, 0x06, 0x81c2);
21717 rtl8168_mdio_write(tp, 0x06, 0xee83);
21718 rtl8168_mdio_write(tp, 0x06, 0x4800);
21719 rtl8168_mdio_write(tp, 0x06, 0xee83);
21720 rtl8168_mdio_write(tp, 0x06, 0x4900);
21721 rtl8168_mdio_write(tp, 0x06, 0xe083);
21722 rtl8168_mdio_write(tp, 0x06, 0x5110);
21723 rtl8168_mdio_write(tp, 0x06, 0xe483);
21724 rtl8168_mdio_write(tp, 0x06, 0x5158);
21725 rtl8168_mdio_write(tp, 0x06, 0x019f);
21726 rtl8168_mdio_write(tp, 0x06, 0xead0);
21727 rtl8168_mdio_write(tp, 0x06, 0x00d1);
21728 rtl8168_mdio_write(tp, 0x06, 0x801f);
21729 rtl8168_mdio_write(tp, 0x06, 0x66e2);
21730 rtl8168_mdio_write(tp, 0x06, 0xf8ea);
21731 rtl8168_mdio_write(tp, 0x06, 0xe3f8);
21732 rtl8168_mdio_write(tp, 0x06, 0xeb5a);
21733 rtl8168_mdio_write(tp, 0x06, 0xf81e);
21734 rtl8168_mdio_write(tp, 0x06, 0x20e6);
21735 rtl8168_mdio_write(tp, 0x06, 0xf8ea);
21736 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21737 rtl8168_mdio_write(tp, 0x06, 0xebd3);
21738 rtl8168_mdio_write(tp, 0x06, 0x02b3);
21739 rtl8168_mdio_write(tp, 0x06, 0xfee2);
21740 rtl8168_mdio_write(tp, 0x06, 0xf87c);
21741 rtl8168_mdio_write(tp, 0x06, 0xef32);
21742 rtl8168_mdio_write(tp, 0x06, 0x5b80);
21743 rtl8168_mdio_write(tp, 0x06, 0xe3f8);
21744 rtl8168_mdio_write(tp, 0x06, 0x7d9e);
21745 rtl8168_mdio_write(tp, 0x06, 0x037d);
21746 rtl8168_mdio_write(tp, 0x06, 0xffff);
21747 rtl8168_mdio_write(tp, 0x06, 0x0d58);
21748 rtl8168_mdio_write(tp, 0x06, 0x1c55);
21749 rtl8168_mdio_write(tp, 0x06, 0x1a65);
21750 rtl8168_mdio_write(tp, 0x06, 0x11a1);
21751 rtl8168_mdio_write(tp, 0x06, 0x90d3);
21752 rtl8168_mdio_write(tp, 0x06, 0xe283);
21753 rtl8168_mdio_write(tp, 0x06, 0x48e3);
21754 rtl8168_mdio_write(tp, 0x06, 0x8349);
21755 rtl8168_mdio_write(tp, 0x06, 0x1b56);
21756 rtl8168_mdio_write(tp, 0x06, 0xab08);
21757 rtl8168_mdio_write(tp, 0x06, 0xef56);
21758 rtl8168_mdio_write(tp, 0x06, 0xe683);
21759 rtl8168_mdio_write(tp, 0x06, 0x48e7);
21760 rtl8168_mdio_write(tp, 0x06, 0x8349);
21761 rtl8168_mdio_write(tp, 0x06, 0x10d1);
21762 rtl8168_mdio_write(tp, 0x06, 0x801f);
21763 rtl8168_mdio_write(tp, 0x06, 0x66a0);
21764 rtl8168_mdio_write(tp, 0x06, 0x04b9);
21765 rtl8168_mdio_write(tp, 0x06, 0xe283);
21766 rtl8168_mdio_write(tp, 0x06, 0x48e3);
21767 rtl8168_mdio_write(tp, 0x06, 0x8349);
21768 rtl8168_mdio_write(tp, 0x06, 0xef65);
21769 rtl8168_mdio_write(tp, 0x06, 0xe283);
21770 rtl8168_mdio_write(tp, 0x06, 0x4ae3);
21771 rtl8168_mdio_write(tp, 0x06, 0x834b);
21772 rtl8168_mdio_write(tp, 0x06, 0x1b56);
21773 rtl8168_mdio_write(tp, 0x06, 0xaa0e);
21774 rtl8168_mdio_write(tp, 0x06, 0xef56);
21775 rtl8168_mdio_write(tp, 0x06, 0xe683);
21776 rtl8168_mdio_write(tp, 0x06, 0x4ae7);
21777 rtl8168_mdio_write(tp, 0x06, 0x834b);
21778 rtl8168_mdio_write(tp, 0x06, 0xe283);
21779 rtl8168_mdio_write(tp, 0x06, 0x4de6);
21780 rtl8168_mdio_write(tp, 0x06, 0x834c);
21781 rtl8168_mdio_write(tp, 0x06, 0xe083);
21782 rtl8168_mdio_write(tp, 0x06, 0x4da0);
21783 rtl8168_mdio_write(tp, 0x06, 0x000c);
21784 rtl8168_mdio_write(tp, 0x06, 0xaf81);
21785 rtl8168_mdio_write(tp, 0x06, 0x8be0);
21786 rtl8168_mdio_write(tp, 0x06, 0x834d);
21787 rtl8168_mdio_write(tp, 0x06, 0x10e4);
21788 rtl8168_mdio_write(tp, 0x06, 0x834d);
21789 rtl8168_mdio_write(tp, 0x06, 0xae04);
21790 rtl8168_mdio_write(tp, 0x06, 0x80e4);
21791 rtl8168_mdio_write(tp, 0x06, 0x834d);
21792 rtl8168_mdio_write(tp, 0x06, 0xe083);
21793 rtl8168_mdio_write(tp, 0x06, 0x4e78);
21794 rtl8168_mdio_write(tp, 0x06, 0x039e);
21795 rtl8168_mdio_write(tp, 0x06, 0x0be0);
21796 rtl8168_mdio_write(tp, 0x06, 0x834e);
21797 rtl8168_mdio_write(tp, 0x06, 0x7804);
21798 rtl8168_mdio_write(tp, 0x06, 0x9e04);
21799 rtl8168_mdio_write(tp, 0x06, 0xee83);
21800 rtl8168_mdio_write(tp, 0x06, 0x4e02);
21801 rtl8168_mdio_write(tp, 0x06, 0xe083);
21802 rtl8168_mdio_write(tp, 0x06, 0x32e1);
21803 rtl8168_mdio_write(tp, 0x06, 0x8333);
21804 rtl8168_mdio_write(tp, 0x06, 0x590f);
21805 rtl8168_mdio_write(tp, 0x06, 0xe283);
21806 rtl8168_mdio_write(tp, 0x06, 0x4d0c);
21807 rtl8168_mdio_write(tp, 0x06, 0x245a);
21808 rtl8168_mdio_write(tp, 0x06, 0xf01e);
21809 rtl8168_mdio_write(tp, 0x06, 0x12e4);
21810 rtl8168_mdio_write(tp, 0x06, 0xf88c);
21811 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21812 rtl8168_mdio_write(tp, 0x06, 0x8de0);
21813 rtl8168_mdio_write(tp, 0x06, 0x8330);
21814 rtl8168_mdio_write(tp, 0x06, 0xe183);
21815 rtl8168_mdio_write(tp, 0x06, 0x3168);
21816 rtl8168_mdio_write(tp, 0x06, 0x01e4);
21817 rtl8168_mdio_write(tp, 0x06, 0xf88a);
21818 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21819 rtl8168_mdio_write(tp, 0x06, 0x8bae);
21820 rtl8168_mdio_write(tp, 0x06, 0x37ee);
21821 rtl8168_mdio_write(tp, 0x06, 0x834e);
21822 rtl8168_mdio_write(tp, 0x06, 0x03e0);
21823 rtl8168_mdio_write(tp, 0x06, 0x834c);
21824 rtl8168_mdio_write(tp, 0x06, 0xe183);
21825 rtl8168_mdio_write(tp, 0x06, 0x4d1b);
21826 rtl8168_mdio_write(tp, 0x06, 0x019e);
21827 rtl8168_mdio_write(tp, 0x06, 0x04aa);
21828 rtl8168_mdio_write(tp, 0x06, 0xa1ae);
21829 rtl8168_mdio_write(tp, 0x06, 0xa8ee);
21830 rtl8168_mdio_write(tp, 0x06, 0x834e);
21831 rtl8168_mdio_write(tp, 0x06, 0x04ee);
21832 rtl8168_mdio_write(tp, 0x06, 0x834f);
21833 rtl8168_mdio_write(tp, 0x06, 0x00ae);
21834 rtl8168_mdio_write(tp, 0x06, 0xabe0);
21835 rtl8168_mdio_write(tp, 0x06, 0x834f);
21836 rtl8168_mdio_write(tp, 0x06, 0x7803);
21837 rtl8168_mdio_write(tp, 0x06, 0x9f14);
21838 rtl8168_mdio_write(tp, 0x06, 0xee83);
21839 rtl8168_mdio_write(tp, 0x06, 0x4e05);
21840 rtl8168_mdio_write(tp, 0x06, 0xd240);
21841 rtl8168_mdio_write(tp, 0x06, 0xd655);
21842 rtl8168_mdio_write(tp, 0x06, 0x5402);
21843 rtl8168_mdio_write(tp, 0x06, 0x81c6);
21844 rtl8168_mdio_write(tp, 0x06, 0xd2a0);
21845 rtl8168_mdio_write(tp, 0x06, 0xd6ba);
21846 rtl8168_mdio_write(tp, 0x06, 0x0002);
21847 rtl8168_mdio_write(tp, 0x06, 0x81c6);
21848 rtl8168_mdio_write(tp, 0x06, 0xfefd);
21849 rtl8168_mdio_write(tp, 0x06, 0xfc05);
21850 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
21851 rtl8168_mdio_write(tp, 0x06, 0xf860);
21852 rtl8168_mdio_write(tp, 0x06, 0xe1f8);
21853 rtl8168_mdio_write(tp, 0x06, 0x6168);
21854 rtl8168_mdio_write(tp, 0x06, 0x02e4);
21855 rtl8168_mdio_write(tp, 0x06, 0xf860);
21856 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21857 rtl8168_mdio_write(tp, 0x06, 0x61e0);
21858 rtl8168_mdio_write(tp, 0x06, 0xf848);
21859 rtl8168_mdio_write(tp, 0x06, 0xe1f8);
21860 rtl8168_mdio_write(tp, 0x06, 0x4958);
21861 rtl8168_mdio_write(tp, 0x06, 0x0f1e);
21862 rtl8168_mdio_write(tp, 0x06, 0x02e4);
21863 rtl8168_mdio_write(tp, 0x06, 0xf848);
21864 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21865 rtl8168_mdio_write(tp, 0x06, 0x49d0);
21866 rtl8168_mdio_write(tp, 0x06, 0x0002);
21867 rtl8168_mdio_write(tp, 0x06, 0x820a);
21868 rtl8168_mdio_write(tp, 0x06, 0xbf83);
21869 rtl8168_mdio_write(tp, 0x06, 0x50ef);
21870 rtl8168_mdio_write(tp, 0x06, 0x46dc);
21871 rtl8168_mdio_write(tp, 0x06, 0x19dd);
21872 rtl8168_mdio_write(tp, 0x06, 0xd001);
21873 rtl8168_mdio_write(tp, 0x06, 0x0282);
21874 rtl8168_mdio_write(tp, 0x06, 0x0a02);
21875 rtl8168_mdio_write(tp, 0x06, 0x8226);
21876 rtl8168_mdio_write(tp, 0x06, 0xe0f8);
21877 rtl8168_mdio_write(tp, 0x06, 0x60e1);
21878 rtl8168_mdio_write(tp, 0x06, 0xf861);
21879 rtl8168_mdio_write(tp, 0x06, 0x58fd);
21880 rtl8168_mdio_write(tp, 0x06, 0xe4f8);
21881 rtl8168_mdio_write(tp, 0x06, 0x60e5);
21882 rtl8168_mdio_write(tp, 0x06, 0xf861);
21883 rtl8168_mdio_write(tp, 0x06, 0xfc04);
21884 rtl8168_mdio_write(tp, 0x06, 0xf9fa);
21885 rtl8168_mdio_write(tp, 0x06, 0xfbc6);
21886 rtl8168_mdio_write(tp, 0x06, 0xbff8);
21887 rtl8168_mdio_write(tp, 0x06, 0x40be);
21888 rtl8168_mdio_write(tp, 0x06, 0x8350);
21889 rtl8168_mdio_write(tp, 0x06, 0xa001);
21890 rtl8168_mdio_write(tp, 0x06, 0x0107);
21891 rtl8168_mdio_write(tp, 0x06, 0x1b89);
21892 rtl8168_mdio_write(tp, 0x06, 0xcfd2);
21893 rtl8168_mdio_write(tp, 0x06, 0x08eb);
21894 rtl8168_mdio_write(tp, 0x06, 0xdb19);
21895 rtl8168_mdio_write(tp, 0x06, 0xb2fb);
21896 rtl8168_mdio_write(tp, 0x06, 0xfffe);
21897 rtl8168_mdio_write(tp, 0x06, 0xfd04);
21898 rtl8168_mdio_write(tp, 0x06, 0xf8e0);
21899 rtl8168_mdio_write(tp, 0x06, 0xf848);
21900 rtl8168_mdio_write(tp, 0x06, 0xe1f8);
21901 rtl8168_mdio_write(tp, 0x06, 0x4968);
21902 rtl8168_mdio_write(tp, 0x06, 0x08e4);
21903 rtl8168_mdio_write(tp, 0x06, 0xf848);
21904 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21905 rtl8168_mdio_write(tp, 0x06, 0x4958);
21906 rtl8168_mdio_write(tp, 0x06, 0xf7e4);
21907 rtl8168_mdio_write(tp, 0x06, 0xf848);
21908 rtl8168_mdio_write(tp, 0x06, 0xe5f8);
21909 rtl8168_mdio_write(tp, 0x06, 0x49fc);
21910 rtl8168_mdio_write(tp, 0x06, 0x044d);
21911 rtl8168_mdio_write(tp, 0x06, 0x2000);
21912 rtl8168_mdio_write(tp, 0x06, 0x024e);
21913 rtl8168_mdio_write(tp, 0x06, 0x2200);
21914 rtl8168_mdio_write(tp, 0x06, 0x024d);
21915 rtl8168_mdio_write(tp, 0x06, 0xdfff);
21916 rtl8168_mdio_write(tp, 0x06, 0x014e);
21917 rtl8168_mdio_write(tp, 0x06, 0xddff);
21918 rtl8168_mdio_write(tp, 0x06, 0x01f8);
21919 rtl8168_mdio_write(tp, 0x06, 0xfafb);
21920 rtl8168_mdio_write(tp, 0x06, 0xef79);
21921 rtl8168_mdio_write(tp, 0x06, 0xbff8);
21922 rtl8168_mdio_write(tp, 0x06, 0x22d8);
21923 rtl8168_mdio_write(tp, 0x06, 0x19d9);
21924 rtl8168_mdio_write(tp, 0x06, 0x5884);
21925 rtl8168_mdio_write(tp, 0x06, 0x9f09);
21926 rtl8168_mdio_write(tp, 0x06, 0xbf82);
21927 rtl8168_mdio_write(tp, 0x06, 0x6dd6);
21928 rtl8168_mdio_write(tp, 0x06, 0x8275);
21929 rtl8168_mdio_write(tp, 0x06, 0x0201);
21930 rtl8168_mdio_write(tp, 0x06, 0x4fef);
21931 rtl8168_mdio_write(tp, 0x06, 0x97ff);
21932 rtl8168_mdio_write(tp, 0x06, 0xfefc);
21933 rtl8168_mdio_write(tp, 0x06, 0x0517);
21934 rtl8168_mdio_write(tp, 0x06, 0xfffe);
21935 rtl8168_mdio_write(tp, 0x06, 0x0117);
21936 rtl8168_mdio_write(tp, 0x06, 0x0001);
21937 rtl8168_mdio_write(tp, 0x06, 0x0200);
21938 rtl8168_mdio_write(tp, 0x05, 0x83d8);
21939 rtl8168_mdio_write(tp, 0x06, 0x8000);
21940 rtl8168_mdio_write(tp, 0x05, 0x83d6);
21941 rtl8168_mdio_write(tp, 0x06, 0x824f);
21942 rtl8168_mdio_write(tp, 0x02, 0x2010);
21943 rtl8168_mdio_write(tp, 0x03, 0xdc00);
21944 rtl8168_mdio_write(tp, 0x1f, 0x0000);
21945 rtl8168_mdio_write(tp, 0x0b, 0x0600);
21946 rtl8168_mdio_write(tp, 0x1f, 0x0005);
21947 rtl8168_mdio_write(tp, 0x05, 0xfff6);
21948 rtl8168_mdio_write(tp, 0x06, 0x00fc);
21949 rtl8168_mdio_write(tp, 0x1f, 0x0000);
21950 }
21951
21952 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21953 rtl8168_mdio_write(tp, 0x0D, 0xF880);
21954 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21955 } else if (tp->mcfg == CFG_METHOD_11) {
21956 rtl8168_mdio_write(tp, 0x1F, 0x0002);
21957 rtl8168_mdio_write(tp, 0x10, 0x0008);
21958 rtl8168_mdio_write(tp, 0x0D, 0x006C);
21959
21960 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21961 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
21962
21963 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21964 rtl8168_mdio_write(tp, 0x0B, 0xA4D8);
21965 rtl8168_mdio_write(tp, 0x09, 0x281C);
21966 rtl8168_mdio_write(tp, 0x07, 0x2883);
21967 rtl8168_mdio_write(tp, 0x0A, 0x6B35);
21968 rtl8168_mdio_write(tp, 0x1D, 0x3DA4);
21969 rtl8168_mdio_write(tp, 0x1C, 0xEFFD);
21970 rtl8168_mdio_write(tp, 0x14, 0x7F52);
21971 rtl8168_mdio_write(tp, 0x18, 0x7FC6);
21972 rtl8168_mdio_write(tp, 0x08, 0x0601);
21973 rtl8168_mdio_write(tp, 0x06, 0x4063);
21974 rtl8168_mdio_write(tp, 0x10, 0xF074);
21975 rtl8168_mdio_write(tp, 0x1F, 0x0003);
21976 rtl8168_mdio_write(tp, 0x13, 0x0789);
21977 rtl8168_mdio_write(tp, 0x12, 0xF4BD);
21978 rtl8168_mdio_write(tp, 0x1A, 0x04FD);
21979 rtl8168_mdio_write(tp, 0x14, 0x84B0);
21980 rtl8168_mdio_write(tp, 0x1F, 0x0000);
21981 rtl8168_mdio_write(tp, 0x00, 0x9200);
21982
21983 rtl8168_mdio_write(tp, 0x1F, 0x0005);
21984 rtl8168_mdio_write(tp, 0x01, 0x0340);
21985 rtl8168_mdio_write(tp, 0x1F, 0x0001);
21986 rtl8168_mdio_write(tp, 0x04, 0x4000);
21987 rtl8168_mdio_write(tp, 0x03, 0x1D21);
21988 rtl8168_mdio_write(tp, 0x02, 0x0C32);
21989 rtl8168_mdio_write(tp, 0x01, 0x0200);
21990 rtl8168_mdio_write(tp, 0x00, 0x5554);
21991 rtl8168_mdio_write(tp, 0x04, 0x4800);
21992 rtl8168_mdio_write(tp, 0x04, 0x4000);
21993 rtl8168_mdio_write(tp, 0x04, 0xF000);
21994 rtl8168_mdio_write(tp, 0x03, 0xDF01);
21995 rtl8168_mdio_write(tp, 0x02, 0xDF20);
21996 rtl8168_mdio_write(tp, 0x01, 0x101A);
21997 rtl8168_mdio_write(tp, 0x00, 0xA0FF);
21998 rtl8168_mdio_write(tp, 0x04, 0xF800);
21999 rtl8168_mdio_write(tp, 0x04, 0xF000);
22000 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22001
22002 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22003 rtl8168_mdio_write(tp, 0x1E, 0x0023);
22004 rtl8168_mdio_write(tp, 0x16, 0x0000);
22005 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22006
22007 gphy_val = rtl8168_mdio_read(tp, 0x0D);
22008 gphy_val |= BIT_5;
22009 rtl8168_mdio_write(tp, 0x0D, gphy_val);
22010
22011 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22012 gphy_val = rtl8168_mdio_read(tp, 0x0C);
22013 gphy_val |= BIT_10;
22014 rtl8168_mdio_write(tp, 0x0C, gphy_val);
22015 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22016 } else if (tp->mcfg == CFG_METHOD_12) {
22017 rtl8168_mdio_write(tp, 0x1F, 0x0001);
22018 rtl8168_mdio_write(tp, 0x17, 0x0CC0);
22019 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22020
22021 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22022 gphy_val = rtl8168_mdio_read(tp, 0x0D);
22023 gphy_val |= BIT_5;
22024 rtl8168_mdio_write(tp, 0x0D, gphy_val);
22025
22026 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22027 gphy_val = rtl8168_mdio_read(tp, 0x0C);
22028 gphy_val |= BIT_10;
22029 rtl8168_mdio_write(tp, 0x0C, gphy_val);
22030 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22031
22032 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22033 rtl8168_mdio_write(tp, 0x1E, 0x002C);
22034 rtl8168_mdio_write(tp, 0x15, 0x035D);
22035 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22036 rtl8168_mdio_write(tp, 0x01, 0x0300);
22037 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22038 } else if (tp->mcfg == CFG_METHOD_13) {
22039 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22040 gphy_val = rtl8168_mdio_read(tp, 0x0D);
22041 gphy_val |= BIT_5;
22042 rtl8168_mdio_write(tp, 0x0D, gphy_val);
22043
22044 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22045 gphy_val = rtl8168_mdio_read(tp, 0x0C);
22046 gphy_val |= BIT_10;
22047 rtl8168_mdio_write(tp, 0x0C, gphy_val);
22048 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22049 } else if (tp->mcfg == CFG_METHOD_14 || tp->mcfg == CFG_METHOD_15) {
22050 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22051 rtl8168_mdio_write(tp, 0x1E, 0x0023);
22052 gphy_val = rtl8168_mdio_read(tp, 0x17) | BIT_1;
22053 if (tp->RequiredSecLanDonglePatch)
22054 gphy_val &= ~(BIT_2);
22055 else
22056 gphy_val |= (BIT_2);
22057 rtl8168_mdio_write(tp, 0x17, gphy_val);
22058 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22059
22060 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22061 rtl8168_mdio_write(tp, 0x05, 0x8b80);
22062 rtl8168_mdio_write(tp, 0x06, 0xc896);
22063 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22064
22065 rtl8168_mdio_write(tp, 0x1F, 0x0001);
22066 rtl8168_mdio_write(tp, 0x0B, 0x6C20);
22067 rtl8168_mdio_write(tp, 0x07, 0x2872);
22068 rtl8168_mdio_write(tp, 0x1C, 0xEFFF);
22069 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22070 rtl8168_mdio_write(tp, 0x14, 0x6420);
22071 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22072
22073 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22074 gphy_val = rtl8168_mdio_read(tp, 0x08) & 0x00FF;
22075 rtl8168_mdio_write(tp, 0x08, gphy_val | 0x8000);
22076 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22077
22078 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22079 rtl8168_mdio_write(tp, 0x1E, 0x002D);
22080 gphy_val = rtl8168_mdio_read(tp, 0x18);
22081 rtl8168_mdio_write(tp, 0x18, gphy_val | 0x0010);
22082 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22083 gphy_val = rtl8168_mdio_read(tp, 0x14);
22084 rtl8168_mdio_write(tp, 0x14, gphy_val | 0x8000);
22085
22086 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22087 rtl8168_mdio_write(tp, 0x00, 0x080B);
22088 rtl8168_mdio_write(tp, 0x0B, 0x09D7);
22089 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22090
22091 if (aspm) {
22092 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22093 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22094 rtl8168_mdio_write(tp, 0x15, 0x1006);
22095 }
22096 }
22097
22098 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22099 rtl8168_mdio_write(tp, 0x19, 0x7F46);
22100 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22101 rtl8168_mdio_write(tp, 0x05, 0x8AD2);
22102 rtl8168_mdio_write(tp, 0x06, 0x6810);
22103 rtl8168_mdio_write(tp, 0x05, 0x8AD4);
22104 rtl8168_mdio_write(tp, 0x06, 0x8002);
22105 rtl8168_mdio_write(tp, 0x05, 0x8ADE);
22106 rtl8168_mdio_write(tp, 0x06, 0x8025);
22107 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22108
22109 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22110 rtl8168_mdio_write(tp, 0x1E, 0x002F);
22111 rtl8168_mdio_write(tp, 0x15, 0x1919);
22112 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22113
22114 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22115 rtl8168_mdio_write(tp, 0x1E, 0x002D);
22116 gphy_val = rtl8168_mdio_read(tp, 0x18);
22117 rtl8168_mdio_write(tp, 0x18, gphy_val | 0x0040);
22118 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22119
22120 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22121 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22122 gphy_val = rtl8168_mdio_read(tp, 0x06);
22123 rtl8168_mdio_write(tp, 0x06, gphy_val | 0x0001);
22124 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22125
22126 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22127 rtl8168_mdio_write(tp, 0x1E, 0x00AC);
22128 rtl8168_mdio_write(tp, 0x18, 0x0006);
22129 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22130 } else if (tp->mcfg == CFG_METHOD_16) {
22131 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22132 rtl8168_mdio_write(tp, 0x05, 0x8B80);
22133 gphy_val = rtl8168_mdio_read(tp, 0x06);
22134 gphy_val |= BIT_2 | BIT_1;
22135 rtl8168_mdio_write(tp, 0x06, gphy_val);
22136 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22137
22138 rtl8168_mdio_write(tp, 0x1f, 0x0004);
22139 rtl8168_mdio_write(tp, 0x1f, 0x0007);
22140 rtl8168_mdio_write(tp, 0x1e, 0x002D);
22141 gphy_val = rtl8168_mdio_read(tp, 0x18);
22142 gphy_val |= BIT_4;
22143 rtl8168_mdio_write(tp, 0x18, gphy_val);
22144 rtl8168_mdio_write(tp, 0x1f, 0x0002);
22145 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22146 gphy_val = rtl8168_mdio_read(tp, 0x14);
22147 gphy_val |= BIT_15;
22148 rtl8168_mdio_write(tp, 0x14, gphy_val);
22149
22150 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22151 rtl8168_mdio_write(tp, 0x15, 0x1006);
22152
22153 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22154 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22155 gphy_val = rtl8168_mdio_read(tp, 0x06);
22156 gphy_val |= BIT_0;
22157 rtl8168_mdio_write(tp, 0x06, gphy_val);
22158 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22159
22160 rtl8168_mdio_write(tp, 0x1F, 0x0001);
22161 rtl8168_mdio_write(tp, 0x0B, 0x6C14);
22162 rtl8168_mdio_write(tp, 0x14, 0x7F3D);
22163 rtl8168_mdio_write(tp, 0x1C, 0xFAFE);
22164 rtl8168_mdio_write(tp, 0x08, 0x07C5);
22165 rtl8168_mdio_write(tp, 0x10, 0xF090);
22166 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22167 rtl8168_mdio_write(tp, 0x14, 0x641A);
22168 rtl8168_mdio_write(tp, 0x1A, 0x0606);
22169 rtl8168_mdio_write(tp, 0x12, 0xF480);
22170 rtl8168_mdio_write(tp, 0x13, 0x0747);
22171 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22172
22173 rtl8168_mdio_write(tp, 0x1F, 0x0004);
22174 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22175 rtl8168_mdio_write(tp, 0x1E, 0x0078);
22176 rtl8168_mdio_write(tp, 0x15, 0xA408);
22177 rtl8168_mdio_write(tp, 0x17, 0x5100);
22178 rtl8168_mdio_write(tp, 0x19, 0x0008);
22179 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22180 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22181
22182 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22183 rtl8168_mdio_write(tp, 0x0D, 0x0207);
22184 rtl8168_mdio_write(tp, 0x02, 0x5FD0);
22185 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22186
22187 rtl8168_mdio_write(tp, 0x1F, 0x0004);
22188 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22189 rtl8168_mdio_write(tp, 0x1E, 0x00A1);
22190 gphy_val = rtl8168_mdio_read(tp, 0x1A);
22191 gphy_val &= ~BIT_2;
22192 rtl8168_mdio_write(tp, 0x1A, gphy_val);
22193 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22194 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22195
22196 rtl8168_mdio_write(tp, 0x1F, 0x0004);
22197 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22198 rtl8168_mdio_write(tp, 0x1E, 0x002D);
22199 gphy_val = rtl8168_mdio_read(tp, 0x16);
22200 gphy_val |= BIT_5;
22201 rtl8168_mdio_write(tp, 0x16, gphy_val);
22202 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22203 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22204
22205 rtl8168_mdio_write(tp, 0x1F, 0x0004);
22206 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22207 rtl8168_mdio_write(tp, 0x1E, 0x00AC);
22208 rtl8168_mdio_write(tp, 0x18, 0x0006);
22209 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22210 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22211
22212 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22213 rtl8168_mdio_write(tp, 0x09, 0xA20F);
22214 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22215
22216 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22217 rtl8168_mdio_write(tp, 0x05, 0x8B5B);
22218 rtl8168_mdio_write(tp, 0x06, 0x9222);
22219 rtl8168_mdio_write(tp, 0x05, 0x8B6D);
22220 rtl8168_mdio_write(tp, 0x06, 0x8000);
22221 rtl8168_mdio_write(tp, 0x05, 0x8B76);
22222 rtl8168_mdio_write(tp, 0x06, 0x8000);
22223 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22224
22225 if (pdev->subsystem_vendor == 0x1043 &&
22226 pdev->subsystem_device == 0x13F7) {
22227
22228 static const u16 evl_phy_value[] = {
22229 0x8B56, 0x8B5F, 0x8B68, 0x8B71,
22230 0x8B7A, 0x8A7B, 0x8A7E, 0x8A81,
22231 0x8A84, 0x8A87
22232 };
22233
22234 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22235 for (i = 0; i < ARRAY_SIZE(evl_phy_value); i++) {
22236 rtl8168_mdio_write(tp, 0x05, evl_phy_value[i]);
22237 gphy_val = (0xAA << 8) | (rtl8168_mdio_read(tp, 0x06) & 0xFF);
22238 rtl8168_mdio_write(tp, 0x06, gphy_val);
22239 }
22240 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22241 rtl8168_mdio_write(tp, 0x1E, 0x0078);
22242 rtl8168_mdio_write(tp, 0x17, 0x51AA);
22243 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22244 }
22245
22246 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22247 rtl8168_mdio_write(tp, 0x05, 0x8B54);
22248 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22249 rtl8168_mdio_write(tp, 0x05, 0x8B5D);
22250 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22251 rtl8168_mdio_write(tp, 0x05, 0x8A7C);
22252 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22253 rtl8168_mdio_write(tp, 0x05, 0x8A7F);
22254 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_8);
22255 rtl8168_mdio_write(tp, 0x05, 0x8A82);
22256 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22257 rtl8168_mdio_write(tp, 0x05, 0x8A85);
22258 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22259 rtl8168_mdio_write(tp, 0x05, 0x8A88);
22260 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22261 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22262
22263 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22264 rtl8168_mdio_write(tp, 0x05, 0x8B85);
22265 gphy_val = rtl8168_mdio_read(tp, 0x06) | BIT_14 | BIT_15;
22266 rtl8168_mdio_write(tp, 0x06, gphy_val);
22267 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22268 } else if (tp->mcfg == CFG_METHOD_17) {
22269 if (pdev->subsystem_vendor == 0x144d &&
22270 pdev->subsystem_device == 0xc0a6) {
22271 rtl8168_mdio_write(tp, 0x1F, 0x0001);
22272 rtl8168_mdio_write(tp, 0x0e, 0x6b7f);
22273 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22274 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22275 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22276 gphy_val = rtl8168_mdio_read(tp, 0x06);
22277 gphy_val |= BIT_4;
22278 rtl8168_mdio_write(tp, 0x06, gphy_val);
22279 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22280 } else {
22281 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22282 rtl8168_mdio_write(tp, 0x05, 0x8B80);
22283 gphy_val = rtl8168_mdio_read(tp, 0x06);
22284 gphy_val |= BIT_2 | BIT_1;
22285 rtl8168_mdio_write(tp, 0x06, gphy_val);
22286 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22287
22288 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22289 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22290 gphy_val = rtl8168_mdio_read(tp, 0x06);
22291 gphy_val &= ~BIT_4;
22292 rtl8168_mdio_write(tp, 0x06, gphy_val);
22293 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22294 }
22295
22296 rtl8168_mdio_write(tp, 0x1f, 0x0004);
22297 rtl8168_mdio_write(tp, 0x1f, 0x0007);
22298 rtl8168_mdio_write(tp, 0x1e, 0x002D);
22299 gphy_val = rtl8168_mdio_read(tp, 0x18);
22300 gphy_val |= BIT_4;
22301 rtl8168_mdio_write(tp, 0x18, gphy_val);
22302 rtl8168_mdio_write(tp, 0x1f, 0x0002);
22303 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22304 gphy_val = rtl8168_mdio_read(tp, 0x14);
22305 gphy_val |= BIT_15;
22306 rtl8168_mdio_write(tp, 0x14, gphy_val);
22307
22308 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22309 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22310 gphy_val = rtl8168_mdio_read(tp, 0x06);
22311 gphy_val |= BIT_0;
22312 rtl8168_mdio_write(tp, 0x06, gphy_val);
22313 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22314
22315 rtl8168_mdio_write(tp, 0x1F, 0x0004);
22316 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22317 rtl8168_mdio_write(tp, 0x1E, 0x00AC);
22318 rtl8168_mdio_write(tp, 0x18, 0x0006);
22319 rtl8168_mdio_write(tp, 0x1F, 0x0002);
22320 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22321
22322 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22323 rtl8168_mdio_write(tp, 0x09, 0xA20F);
22324 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22325
22326 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22327 rtl8168_mdio_write(tp, 0x05, 0x8B85);
22328 gphy_val = rtl8168_mdio_read(tp, 0x06) | BIT_14 | BIT_15;
22329 rtl8168_mdio_write(tp, 0x06, gphy_val);
22330 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22331
22332 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22333 rtl8168_mdio_write(tp, 0x05, 0x8B5B);
22334 rtl8168_mdio_write(tp, 0x06, 0x9222);
22335 rtl8168_mdio_write(tp, 0x05, 0x8B6D);
22336 rtl8168_mdio_write(tp, 0x06, 0x8000);
22337 rtl8168_mdio_write(tp, 0x05, 0x8B76);
22338 rtl8168_mdio_write(tp, 0x06, 0x8000);
22339 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22340
22341 if (pdev->subsystem_vendor == 0x1043 &&
22342 pdev->subsystem_device == 0x13F7) {
22343
22344 static const u16 evl_phy_value[] = {
22345 0x8B56, 0x8B5F, 0x8B68, 0x8B71,
22346 0x8B7A, 0x8A7B, 0x8A7E, 0x8A81,
22347 0x8A84, 0x8A87
22348 };
22349
22350 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22351 for (i = 0; i < ARRAY_SIZE(evl_phy_value); i++) {
22352 rtl8168_mdio_write(tp, 0x05, evl_phy_value[i]);
22353 gphy_val = (0xAA << 8) | (rtl8168_mdio_read(tp, 0x06) & 0xFF);
22354 rtl8168_mdio_write(tp, 0x06, gphy_val);
22355 }
22356 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22357 rtl8168_mdio_write(tp, 0x1E, 0x0078);
22358 rtl8168_mdio_write(tp, 0x17, 0x51AA);
22359 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22360 }
22361
22362 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22363 rtl8168_mdio_write(tp, 0x05, 0x8B54);
22364 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22365 rtl8168_mdio_write(tp, 0x05, 0x8B5D);
22366 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22367 rtl8168_mdio_write(tp, 0x05, 0x8A7C);
22368 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22369 rtl8168_mdio_write(tp, 0x05, 0x8A7F);
22370 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_8);
22371 rtl8168_mdio_write(tp, 0x05, 0x8A82);
22372 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22373 rtl8168_mdio_write(tp, 0x05, 0x8A85);
22374 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22375 rtl8168_mdio_write(tp, 0x05, 0x8A88);
22376 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22377 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22378
22379 if (aspm) {
22380 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22381 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22382 gphy_val = rtl8168_mdio_read(tp, 0x15);
22383 gphy_val |= BIT_12;
22384 rtl8168_mdio_write(tp, 0x15, gphy_val);
22385 }
22386 }
22387 } else if (tp->mcfg == CFG_METHOD_18) {
22388 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22389 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22390 rtl8168_mdio_write(tp, 0x05, 0x8b80);
22391 gphy_val = rtl8168_mdio_read(tp, 0x06);
22392 gphy_val |= BIT_2 | BIT_1;
22393 rtl8168_mdio_write(tp, 0x06, gphy_val);
22394 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22395 }
22396
22397 rtl8168_mdio_write(tp, 0x1f, 0x0007);
22398 rtl8168_mdio_write(tp, 0x1e, 0x002D);
22399 gphy_val = rtl8168_mdio_read(tp, 0x18);
22400 gphy_val |= BIT_4;
22401 rtl8168_mdio_write(tp, 0x18, gphy_val);
22402 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22403 gphy_val = rtl8168_mdio_read(tp, 0x14);
22404 gphy_val |= BIT_15;
22405 rtl8168_mdio_write(tp, 0x14, gphy_val);
22406
22407 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22408 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22409 gphy_val = rtl8168_mdio_read(tp, 0x06);
22410 gphy_val |= BIT_0;
22411 rtl8168_mdio_write(tp, 0x06, gphy_val);
22412 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22413
22414 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22415 rtl8168_mdio_write(tp, 0x05, 0x8B85);
22416 gphy_val = rtl8168_mdio_read(tp, 0x06);
22417 gphy_val |= BIT_14;
22418 rtl8168_mdio_write(tp, 0x06, gphy_val);
22419 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22420
22421 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22422 rtl8168_mdio_write(tp, 0x09, 0xA20F);
22423 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22424
22425 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22426 rtl8168_mdio_write(tp, 0x05, 0x8B55);
22427 rtl8168_mdio_write(tp, 0x06, 0x0000);
22428 rtl8168_mdio_write(tp, 0x05, 0x8B5E);
22429 rtl8168_mdio_write(tp, 0x06, 0x0000);
22430 rtl8168_mdio_write(tp, 0x05, 0x8B67);
22431 rtl8168_mdio_write(tp, 0x06, 0x0000);
22432 rtl8168_mdio_write(tp, 0x05, 0x8B70);
22433 rtl8168_mdio_write(tp, 0x06, 0x0000);
22434 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22435 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22436 rtl8168_mdio_write(tp, 0x1E, 0x0078);
22437 rtl8168_mdio_write(tp, 0x17, 0x0000);
22438 rtl8168_mdio_write(tp, 0x19, 0x00FB);
22439 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22440
22441 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22442 rtl8168_mdio_write(tp, 0x05, 0x8B79);
22443 rtl8168_mdio_write(tp, 0x06, 0xAA00);
22444 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22445
22446 rtl8168_mdio_write(tp, 0x1f, 0x0003);
22447 rtl8168_mdio_write(tp, 0x01, 0x328A);
22448 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22449
22450 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22451 rtl8168_mdio_write(tp, 0x05, 0x8B54);
22452 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22453 rtl8168_mdio_write(tp, 0x05, 0x8B5D);
22454 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22455 rtl8168_mdio_write(tp, 0x05, 0x8A7C);
22456 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22457 rtl8168_mdio_write(tp, 0x05, 0x8A7F);
22458 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_8);
22459 rtl8168_mdio_write(tp, 0x05, 0x8A82);
22460 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22461 rtl8168_mdio_write(tp, 0x05, 0x8A85);
22462 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22463 rtl8168_mdio_write(tp, 0x05, 0x8A88);
22464 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22465 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22466
22467 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22468 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22469 rtl8168_mdio_write(tp, 0x05, 0x8b85);
22470 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_15);
22471 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22472 }
22473
22474 if (aspm) {
22475 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22476 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22477 gphy_val = rtl8168_mdio_read(tp, 0x15);
22478 gphy_val |= BIT_12;
22479 rtl8168_mdio_write(tp, 0x15, gphy_val);
22480 }
22481 }
22482 } else if (tp->mcfg == CFG_METHOD_19) {
22483 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22484 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22485 rtl8168_mdio_write(tp, 0x05, 0x8b80);
22486 gphy_val = rtl8168_mdio_read(tp, 0x06);
22487 gphy_val |= BIT_2 | BIT_1;
22488 rtl8168_mdio_write(tp, 0x06, gphy_val);
22489 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22490 }
22491
22492 rtl8168_mdio_write(tp, 0x1f, 0x0007);
22493 rtl8168_mdio_write(tp, 0x1e, 0x002D);
22494 gphy_val = rtl8168_mdio_read(tp, 0x18);
22495 gphy_val |= BIT_4;
22496 rtl8168_mdio_write(tp, 0x18, gphy_val);
22497 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22498 gphy_val = rtl8168_mdio_read(tp, 0x14);
22499 gphy_val |= BIT_15;
22500 rtl8168_mdio_write(tp, 0x14, gphy_val);
22501
22502 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22503 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22504 gphy_val = rtl8168_mdio_read(tp, 0x06);
22505 gphy_val |= BIT_0;
22506 rtl8168_mdio_write(tp, 0x06, gphy_val);
22507 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22508
22509 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22510 rtl8168_mdio_write(tp, 0x05, 0x8B54);
22511 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22512 rtl8168_mdio_write(tp, 0x05, 0x8B5D);
22513 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22514 rtl8168_mdio_write(tp, 0x05, 0x8A7C);
22515 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22516 rtl8168_mdio_write(tp, 0x05, 0x8A7F);
22517 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_8);
22518 rtl8168_mdio_write(tp, 0x05, 0x8A82);
22519 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22520 rtl8168_mdio_write(tp, 0x05, 0x8A85);
22521 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22522 rtl8168_mdio_write(tp, 0x05, 0x8A88);
22523 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22524 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22525
22526 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22527 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22528 rtl8168_mdio_write(tp, 0x05, 0x8b85);
22529 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_15);
22530 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22531 }
22532
22533 if (aspm) {
22534 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22535 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22536 gphy_val = rtl8168_mdio_read(tp, 0x15);
22537 gphy_val |= BIT_12;
22538 rtl8168_mdio_write(tp, 0x15, gphy_val);
22539 }
22540 }
22541 } else if (tp->mcfg == CFG_METHOD_20) {
22542
22543 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22544 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22545 rtl8168_mdio_write(tp, 0x05, 0x8b80);
22546 gphy_val = rtl8168_mdio_read(tp, 0x06);
22547 gphy_val |= BIT_2 | BIT_1;
22548 rtl8168_mdio_write(tp, 0x06, gphy_val);
22549 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22550 }
22551
22552 rtl8168_mdio_write(tp, 0x1f, 0x0007);
22553 rtl8168_mdio_write(tp, 0x1e, 0x002D);
22554 gphy_val = rtl8168_mdio_read(tp, 0x18);
22555 gphy_val |= BIT_4;
22556 rtl8168_mdio_write(tp, 0x18, gphy_val);
22557 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22558 gphy_val = rtl8168_mdio_read(tp, 0x14);
22559 gphy_val |= BIT_15;
22560 rtl8168_mdio_write(tp, 0x14, gphy_val);
22561
22562 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22563 rtl8168_mdio_write(tp, 0x05, 0x8B86);
22564 gphy_val = rtl8168_mdio_read(tp, 0x06);
22565 gphy_val |= BIT_0;
22566 rtl8168_mdio_write(tp, 0x06, gphy_val);
22567 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22568
22569 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22570 rtl8168_mdio_write(tp, 0x05, 0x8B85);
22571 gphy_val = rtl8168_mdio_read(tp, 0x06);
22572 gphy_val |= BIT_14;
22573 rtl8168_mdio_write(tp, 0x06, gphy_val);
22574 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22575
22576 rtl8168_mdio_write(tp, 0x1F, 0x0003);
22577 rtl8168_mdio_write(tp, 0x09, 0xA20F);
22578 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22579
22580 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22581 rtl8168_mdio_write(tp, 0x05, 0x8B55);
22582 rtl8168_mdio_write(tp, 0x06, 0x0000);
22583 rtl8168_mdio_write(tp, 0x05, 0x8B5E);
22584 rtl8168_mdio_write(tp, 0x06, 0x0000);
22585 rtl8168_mdio_write(tp, 0x05, 0x8B67);
22586 rtl8168_mdio_write(tp, 0x06, 0x0000);
22587 rtl8168_mdio_write(tp, 0x05, 0x8B70);
22588 rtl8168_mdio_write(tp, 0x06, 0x0000);
22589 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22590 rtl8168_mdio_write(tp, 0x1F, 0x0007);
22591 rtl8168_mdio_write(tp, 0x1E, 0x0078);
22592 rtl8168_mdio_write(tp, 0x17, 0x0000);
22593 rtl8168_mdio_write(tp, 0x19, 0x00FB);
22594 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22595
22596 rtl8168_mdio_write(tp, 0x1F, 0x0005);
22597 rtl8168_mdio_write(tp, 0x05, 0x8B79);
22598 rtl8168_mdio_write(tp, 0x06, 0xAA00);
22599 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22600
22601 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22602 rtl8168_mdio_write(tp, 0x05, 0x8B54);
22603 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22604 rtl8168_mdio_write(tp, 0x05, 0x8B5D);
22605 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_11);
22606 rtl8168_mdio_write(tp, 0x05, 0x8A7C);
22607 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22608 rtl8168_mdio_write(tp, 0x05, 0x8A7F);
22609 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_8);
22610 rtl8168_mdio_write(tp, 0x05, 0x8A82);
22611 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22612 rtl8168_mdio_write(tp, 0x05, 0x8A85);
22613 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22614 rtl8168_mdio_write(tp, 0x05, 0x8A88);
22615 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) & ~BIT_8);
22616 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22617
22618 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22619 rtl8168_mdio_write(tp, 0x1f, 0x0005);
22620 rtl8168_mdio_write(tp, 0x05, 0x8b85);
22621 rtl8168_mdio_write(tp, 0x06, rtl8168_mdio_read(tp, 0x06) | BIT_15);
22622 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22623 }
22624
22625 if (aspm) {
22626 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22627 rtl8168_mdio_write(tp, 0x1f, 0x0000);
22628 gphy_val = rtl8168_mdio_read(tp, 0x15);
22629 gphy_val |= BIT_12;
22630 rtl8168_mdio_write(tp, 0x15, gphy_val);
22631 }
22632 }
22633 } else if (tp->mcfg == CFG_METHOD_21) {
22634 rtl8168_mdio_write(tp, 0x1F, 0x0A46);
22635 gphy_val = rtl8168_mdio_read(tp, 0x10);
22636 rtl8168_mdio_write(tp, 0x1F, 0x0BCC);
22637 if (gphy_val & BIT_8)
22638 rtl8168_clear_eth_phy_bit(tp, 0x12, BIT_15);
22639 else
22640 rtl8168_set_eth_phy_bit(tp, 0x12, BIT_15);
22641 rtl8168_mdio_write(tp, 0x1F, 0x0A46);
22642 gphy_val = rtl8168_mdio_read(tp, 0x13);
22643 rtl8168_mdio_write(tp, 0x1F, 0x0C41);
22644 if (gphy_val & BIT_8)
22645 rtl8168_set_eth_phy_bit(tp, 0x15, BIT_1);
22646 else
22647 rtl8168_clear_eth_phy_bit(tp, 0x15, BIT_1);
22648
22649 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22650 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_2 | BIT_3);
22651
22652 rtl8168_mdio_write(tp, 0x1F, 0x0BCC);
22653 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~BIT_8);
22654 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22655 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_7);
22656 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_6);
22657 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22658 rtl8168_mdio_write(tp, 0x13, 0x8084);
22659 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~(BIT_14 | BIT_13));
22660 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_12);
22661 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_1);
22662 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_0);
22663
22664 rtl8168_mdio_write(tp, 0x1F, 0x0A4B);
22665 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_2);
22666
22667 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22668 rtl8168_mdio_write(tp, 0x13, 0x8012);
22669 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | BIT_15);
22670
22671 rtl8168_mdio_write(tp, 0x1F, 0x0C42);
22672 gphy_val = rtl8168_mdio_read(tp, 0x11);
22673 gphy_val |= BIT_14;
22674 gphy_val &= ~BIT_13;
22675 rtl8168_mdio_write(tp, 0x11, gphy_val);
22676
22677 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22678 rtl8168_mdio_write(tp, 0x13, 0x809A);
22679 rtl8168_mdio_write(tp, 0x14, 0x8022);
22680 rtl8168_mdio_write(tp, 0x13, 0x80A0);
22681 gphy_val = rtl8168_mdio_read(tp, 0x14) & 0x00FF;
22682 gphy_val |= 0x1000;
22683 rtl8168_mdio_write(tp, 0x14, gphy_val);
22684 rtl8168_mdio_write(tp, 0x13, 0x8088);
22685 rtl8168_mdio_write(tp, 0x14, 0x9222);
22686
22687 if (aspm) {
22688 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22689 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22690 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_2);
22691 }
22692 }
22693
22694 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22695 } else if (tp->mcfg == CFG_METHOD_22) {
22696 //do nothing
22697 } else if (tp->mcfg == CFG_METHOD_23) {
22698 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22699 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | (BIT_3 | BIT_2));
22700 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22701
22702 rtl8168_mdio_write(tp, 0x1F, 0x0BCC);
22703 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~BIT_8);
22704 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22705 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_7);
22706 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_6);
22707 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22708 rtl8168_mdio_write(tp, 0x13, 0x8084);
22709 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~(BIT_14 | BIT_13));
22710 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_12);
22711 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_1);
22712 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_0);
22713
22714 rtl8168_mdio_write(tp, 0x1F, 0x0A4B);
22715 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_2);
22716 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22717
22718 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22719 rtl8168_mdio_write(tp, 0x13, 0x8012);
22720 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | BIT_15);
22721 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22722
22723 rtl8168_mdio_write(tp, 0x1F, 0x0C42);
22724 ClearAndSetEthPhyBit(tp,
22725 0x11,
22726 BIT_13,
22727 BIT_14
22728 );
22729 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22730
22731 if (aspm) {
22732 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22733 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22734 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_2);
22735 }
22736 }
22737 } else if (tp->mcfg == CFG_METHOD_24) {
22738 rtl8168_mdio_write(tp, 0x1F, 0x0BCC);
22739 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~BIT_8);
22740 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22741 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_7);
22742 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_6);
22743 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22744 rtl8168_mdio_write(tp, 0x13, 0x8084);
22745 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~(BIT_14 | BIT_13));
22746 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_12);
22747 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_1);
22748 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_0);
22749 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22750 rtl8168_mdio_write(tp, 0x13, 0x8012);
22751 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | BIT_15);
22752
22753 rtl8168_mdio_write(tp, 0x1F, 0x0C42);
22754 gphy_val = rtl8168_mdio_read(tp, 0x11);
22755 gphy_val |= BIT_14;
22756 gphy_val &= ~BIT_13;
22757 rtl8168_mdio_write(tp, 0x11, gphy_val);
22758
22759 if (aspm) {
22760 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22761 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22762 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_2);
22763 }
22764 }
22765 } else if (tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26) {
22766 rtl8168_mdio_write(tp, 0x1F, 0x0BCC);
22767 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~BIT_8);
22768 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22769 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_7);
22770 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_6);
22771 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22772 rtl8168_mdio_write(tp, 0x13, 0x8084);
22773 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~(BIT_14 | BIT_13));
22774 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_12);
22775 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_1);
22776 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_0);
22777
22778 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22779 rtl8168_mdio_write(tp, 0x13, 0x8012);
22780 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | BIT_15);
22781
22782 rtl8168_mdio_write(tp, 0x1F, 0x0BCE);
22783 rtl8168_mdio_write(tp, 0x12, 0x8860);
22784
22785 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22786 rtl8168_mdio_write(tp, 0x13, 0x80F3);
22787 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x8B00);
22788 rtl8168_mdio_write(tp, 0x13, 0x80F0);
22789 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x3A00);
22790 rtl8168_mdio_write(tp, 0x13, 0x80EF);
22791 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x0500);
22792 rtl8168_mdio_write(tp, 0x13, 0x80F6);
22793 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x6E00);
22794 rtl8168_mdio_write(tp, 0x13, 0x80EC);
22795 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x6800);
22796 rtl8168_mdio_write(tp, 0x13, 0x80ED);
22797 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x7C00);
22798 rtl8168_mdio_write(tp, 0x13, 0x80F2);
22799 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xF400);
22800 rtl8168_mdio_write(tp, 0x13, 0x80F4);
22801 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x8500);
22802 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22803 rtl8168_mdio_write(tp, 0x13, 0x8110);
22804 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xA800);
22805 rtl8168_mdio_write(tp, 0x13, 0x810F);
22806 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x1D00);
22807 rtl8168_mdio_write(tp, 0x13, 0x8111);
22808 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xF500);
22809 rtl8168_mdio_write(tp, 0x13, 0x8113);
22810 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x6100);
22811 rtl8168_mdio_write(tp, 0x13, 0x8115);
22812 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x9200);
22813 rtl8168_mdio_write(tp, 0x13, 0x810E);
22814 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x0400);
22815 rtl8168_mdio_write(tp, 0x13, 0x810C);
22816 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x7C00);
22817 rtl8168_mdio_write(tp, 0x13, 0x810B);
22818 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x5A00);
22819 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22820 rtl8168_mdio_write(tp, 0x13, 0x80D1);
22821 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xFF00);
22822 rtl8168_mdio_write(tp, 0x13, 0x80CD);
22823 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x9E00);
22824 rtl8168_mdio_write(tp, 0x13, 0x80D3);
22825 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x0E00);
22826 rtl8168_mdio_write(tp, 0x13, 0x80D5);
22827 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xCA00);
22828 rtl8168_mdio_write(tp, 0x13, 0x80D7);
22829 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x8400);
22830
22831 if (aspm) {
22832 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22833 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22834 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_2);
22835 }
22836 }
22837 } else if (tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28) {
22838 rtl8168_mdio_write(tp, 0x1F, 0x0BCC);
22839 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~BIT_8);
22840 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
22841 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_7);
22842 rtl8168_mdio_write(tp, 0x11, rtl8168_mdio_read(tp, 0x11) | BIT_6);
22843 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22844 rtl8168_mdio_write(tp, 0x13, 0x8084);
22845 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) & ~(BIT_14 | BIT_13));
22846 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_12);
22847 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_1);
22848 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_0);
22849
22850 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22851 rtl8168_mdio_write(tp, 0x13, 0x8012);
22852 rtl8168_mdio_write(tp, 0x14, rtl8168_mdio_read(tp, 0x14) | BIT_15);
22853
22854 rtl8168_mdio_write(tp, 0x1F, 0x0C42);
22855 rtl8168_mdio_write(tp, 0x11, (rtl8168_mdio_read(tp, 0x11) & ~BIT_13) | BIT_14);
22856
22857 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22858 rtl8168_mdio_write(tp, 0x13, 0x80F3);
22859 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x8B00);
22860 rtl8168_mdio_write(tp, 0x13, 0x80F0);
22861 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x3A00);
22862 rtl8168_mdio_write(tp, 0x13, 0x80EF);
22863 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x0500);
22864 rtl8168_mdio_write(tp, 0x13, 0x80F6);
22865 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x6E00);
22866 rtl8168_mdio_write(tp, 0x13, 0x80EC);
22867 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x6800);
22868 rtl8168_mdio_write(tp, 0x13, 0x80ED);
22869 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x7C00);
22870 rtl8168_mdio_write(tp, 0x13, 0x80F2);
22871 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xF400);
22872 rtl8168_mdio_write(tp, 0x13, 0x80F4);
22873 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x8500);
22874 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22875 rtl8168_mdio_write(tp, 0x13, 0x8110);
22876 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xA800);
22877 rtl8168_mdio_write(tp, 0x13, 0x810F);
22878 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x1D00);
22879 rtl8168_mdio_write(tp, 0x13, 0x8111);
22880 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xF500);
22881 rtl8168_mdio_write(tp, 0x13, 0x8113);
22882 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x6100);
22883 rtl8168_mdio_write(tp, 0x13, 0x8115);
22884 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x9200);
22885 rtl8168_mdio_write(tp, 0x13, 0x810E);
22886 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x0400);
22887 rtl8168_mdio_write(tp, 0x13, 0x810C);
22888 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x7C00);
22889 rtl8168_mdio_write(tp, 0x13, 0x810B);
22890 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x5A00);
22891 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22892 rtl8168_mdio_write(tp, 0x13, 0x80D1);
22893 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xFF00);
22894 rtl8168_mdio_write(tp, 0x13, 0x80CD);
22895 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x9E00);
22896 rtl8168_mdio_write(tp, 0x13, 0x80D3);
22897 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x0E00);
22898 rtl8168_mdio_write(tp, 0x13, 0x80D5);
22899 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0xCA00);
22900 rtl8168_mdio_write(tp, 0x13, 0x80D7);
22901 rtl8168_mdio_write(tp, 0x14, (rtl8168_mdio_read(tp, 0x14) & ~0xFF00) | 0x8400);
22902
22903 if (aspm) {
22904 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22905 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22906 rtl8168_mdio_write(tp, 0x10, rtl8168_mdio_read(tp, 0x10) | BIT_2);
22907 }
22908 }
22909 } else if (tp->mcfg == CFG_METHOD_29) {
22910 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22911 rtl8168_mdio_write(tp, 0x13, 0x809b);
22912 ClearAndSetEthPhyBit( tp,
22913 0x14,
22914 0xF800 ,
22915 0x8000
22916 );
22917 rtl8168_mdio_write(tp, 0x13, 0x80A2);
22918 ClearAndSetEthPhyBit( tp,
22919 0x14,
22920 0xFF00 ,
22921 0x8000
22922 );
22923 rtl8168_mdio_write(tp, 0x13, 0x80A4);
22924 ClearAndSetEthPhyBit( tp,
22925 0x14,
22926 0xFF00 ,
22927 0x8500
22928 );
22929 rtl8168_mdio_write(tp, 0x13, 0x809C);
22930 ClearAndSetEthPhyBit( tp,
22931 0x14,
22932 0xFF00 ,
22933 0xbd00
22934 );
22935 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22936
22937 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22938 rtl8168_mdio_write(tp, 0x13, 0x80AD);
22939 ClearAndSetEthPhyBit( tp,
22940 0x14,
22941 0xF800 ,
22942 0x7000
22943 );
22944 rtl8168_mdio_write(tp, 0x13, 0x80B4);
22945 ClearAndSetEthPhyBit( tp,
22946 0x14,
22947 0xFF00 ,
22948 0x5000
22949 );
22950 rtl8168_mdio_write(tp, 0x13, 0x80AC);
22951 ClearAndSetEthPhyBit( tp,
22952 0x14,
22953 0xFF00 ,
22954 0x4000
22955 );
22956 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22957
22958 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
22959 rtl8168_mdio_write(tp, 0x13, 0x808E);
22960 ClearAndSetEthPhyBit( tp,
22961 0x14,
22962 0xFF00 ,
22963 0x1200
22964 );
22965 rtl8168_mdio_write(tp, 0x13, 0x8090);
22966 ClearAndSetEthPhyBit( tp,
22967 0x14,
22968 0xFF00 ,
22969 0xE500
22970 );
22971 rtl8168_mdio_write(tp, 0x13, 0x8092);
22972 ClearAndSetEthPhyBit( tp,
22973 0x14,
22974 0xFF00 ,
22975 0x9F00
22976 );
22977 rtl8168_mdio_write(tp, 0x1F, 0x0000);
22978
22979 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
22980 u16 dout_tapbin;
22981
22982 dout_tapbin = 0x0000;
22983 rtl8168_mdio_write( tp, 0x1F, 0x0A46 );
22984 gphy_val = rtl8168_mdio_read( tp, 0x13 );
22985 gphy_val &= (BIT_1|BIT_0);
22986 gphy_val <<= 2;
22987 dout_tapbin |= gphy_val;
22988
22989 gphy_val = rtl8168_mdio_read( tp, 0x12 );
22990 gphy_val &= (BIT_15|BIT_14);
22991 gphy_val >>= 14;
22992 dout_tapbin |= gphy_val;
22993
22994 dout_tapbin = ~( dout_tapbin^BIT_3 );
22995 dout_tapbin <<= 12;
22996 dout_tapbin &= 0xF000;
22997
22998 rtl8168_mdio_write( tp, 0x1F, 0x0A43 );
22999
23000 rtl8168_mdio_write( tp, 0x13, 0x827A );
23001 ClearAndSetEthPhyBit( tp,
23002 0x14,
23003 BIT_15|BIT_14|BIT_13|BIT_12,
23004 dout_tapbin
23005 );
23006
23007
23008 rtl8168_mdio_write( tp, 0x13, 0x827B );
23009 ClearAndSetEthPhyBit( tp,
23010 0x14,
23011 BIT_15|BIT_14|BIT_13|BIT_12,
23012 dout_tapbin
23013 );
23014
23015
23016 rtl8168_mdio_write( tp, 0x13, 0x827C );
23017 ClearAndSetEthPhyBit( tp,
23018 0x14,
23019 BIT_15|BIT_14|BIT_13|BIT_12,
23020 dout_tapbin
23021 );
23022
23023
23024 rtl8168_mdio_write( tp, 0x13, 0x827D );
23025 ClearAndSetEthPhyBit( tp,
23026 0x14,
23027 BIT_15|BIT_14|BIT_13|BIT_12,
23028 dout_tapbin
23029 );
23030
23031 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23032 rtl8168_mdio_write(tp, 0x13, 0x8011);
23033 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_11);
23034 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
23035 rtl8168_set_eth_phy_bit(tp, 0x16, BIT_1);
23036 }
23037
23038 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
23039 rtl8168_set_eth_phy_bit( tp, 0x11, BIT_11 );
23040 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23041
23042
23043 rtl8168_mdio_write(tp, 0x1F, 0x0BCA);
23044 ClearAndSetEthPhyBit( tp,
23045 0x17,
23046 (BIT_13 | BIT_12) ,
23047 BIT_14
23048 );
23049 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23050
23051 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23052 rtl8168_mdio_write(tp, 0x13, 0x803F);
23053 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23054 rtl8168_mdio_write(tp, 0x13, 0x8047);
23055 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23056 rtl8168_mdio_write(tp, 0x13, 0x804F);
23057 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23058 rtl8168_mdio_write(tp, 0x13, 0x8057);
23059 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23060 rtl8168_mdio_write(tp, 0x13, 0x805F);
23061 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23062 rtl8168_mdio_write(tp, 0x13, 0x8067 );
23063 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23064 rtl8168_mdio_write(tp, 0x13, 0x806F );
23065 rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
23066 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23067
23068 if (aspm) {
23069 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
23070 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23071 rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
23072 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23073 }
23074 }
23075 } else if (tp->mcfg == CFG_METHOD_30) {
23076 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23077 rtl8168_mdio_write(tp, 0x13, 0x808A);
23078 ClearAndSetEthPhyBit( tp,
23079 0x14,
23080 BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0,
23081 0x0A );
23082
23083 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
23084 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23085 rtl8168_mdio_write(tp, 0x13, 0x8011);
23086 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_11);
23087 rtl8168_mdio_write(tp, 0x1F, 0x0A42);
23088 rtl8168_set_eth_phy_bit(tp, 0x16, BIT_1);
23089 }
23090
23091 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
23092 rtl8168_set_eth_phy_bit( tp, 0x11, BIT_11 );
23093 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23094
23095 if (tp->RequireAdcBiasPatch) {
23096 rtl8168_mdio_write(tp, 0x1F, 0x0BCF);
23097 rtl8168_mdio_write(tp, 0x16, tp->AdcBiasPatchIoffset);
23098 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23099 }
23100
23101 {
23102 u16 rlen;
23103
23104 rtl8168_mdio_write(tp, 0x1F, 0x0BCD);
23105 gphy_val = rtl8168_mdio_read( tp, 0x16 );
23106 gphy_val &= 0x000F;
23107
23108 if ( gphy_val > 3 ) {
23109 rlen = gphy_val - 3;
23110 } else {
23111 rlen = 0;
23112 }
23113
23114 gphy_val = rlen | (rlen<<4) | (rlen<<8) | (rlen<<12);
23115
23116 rtl8168_mdio_write(tp, 0x1F, 0x0BCD);
23117 rtl8168_mdio_write(tp, 0x17, gphy_val);
23118 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23119 }
23120
23121 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
23122 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23123 rtl8168_mdio_write(tp, 0x13, 0x85FE);
23124 ClearAndSetEthPhyBit(
23125 tp,
23126 0x14,
23127 BIT_15|BIT_14|BIT_13|BIT_12|BIT_11|BIT_10|BIT_8,
23128 BIT_9);
23129 rtl8168_mdio_write(tp, 0x13, 0x85FF);
23130 ClearAndSetEthPhyBit(
23131 tp,
23132 0x14,
23133 BIT_15|BIT_14|BIT_13|BIT_12,
23134 BIT_11|BIT_10|BIT_9|BIT_8);
23135 rtl8168_mdio_write(tp, 0x13, 0x814B);
23136 ClearAndSetEthPhyBit(
23137 tp,
23138 0x14,
23139 BIT_15|BIT_14|BIT_13|BIT_11|BIT_10|BIT_9|BIT_8,
23140 BIT_12);
23141 }
23142
23143 if (aspm) {
23144 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
23145 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23146 rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
23147 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23148 }
23149 }
23150 } else if (tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
23151 tp->mcfg == CFG_METHOD_33) {
23152 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23153 rtl8168_mdio_write(tp, 0x13, 0x808E);
23154 ClearAndSetEthPhyBit( tp,
23155 0x14,
23156 0xFF00 ,
23157 0x4800
23158 );
23159 rtl8168_mdio_write(tp, 0x13, 0x8090);
23160 ClearAndSetEthPhyBit( tp,
23161 0x14,
23162 0xFF00 ,
23163 0xCC00
23164 );
23165 rtl8168_mdio_write(tp, 0x13, 0x8092);
23166 ClearAndSetEthPhyBit( tp,
23167 0x14,
23168 0xFF00 ,
23169 0xB000
23170 );
23171 rtl8168_mdio_write(tp, 0x13, 0x8088);
23172 ClearAndSetEthPhyBit( tp,
23173 0x14,
23174 0xFF00 ,
23175 0x6000
23176 );
23177 rtl8168_mdio_write(tp, 0x13, 0x808B);
23178 ClearAndSetEthPhyBit( tp,
23179 0x14,
23180 0x3F00 ,
23181 0x0B00
23182 );
23183 rtl8168_mdio_write(tp, 0x13, 0x808D);
23184 ClearAndSetEthPhyBit( tp,
23185 0x14,
23186 0x1F00 ,
23187 0x0600
23188 );
23189 rtl8168_mdio_write(tp, 0x13, 0x808C);
23190 ClearAndSetEthPhyBit( tp,
23191 0x14,
23192 0xFF00 ,
23193 0xB000
23194 );
23195
23196 rtl8168_mdio_write(tp, 0x13, 0x80A0);
23197 ClearAndSetEthPhyBit( tp,
23198 0x14,
23199 0xFF00 ,
23200 0x2800
23201 );
23202 rtl8168_mdio_write(tp, 0x13, 0x80A2);
23203 ClearAndSetEthPhyBit( tp,
23204 0x14,
23205 0xFF00 ,
23206 0x5000
23207 );
23208 rtl8168_mdio_write(tp, 0x13, 0x809B);
23209 ClearAndSetEthPhyBit( tp,
23210 0x14,
23211 0xF800 ,
23212 0xB000
23213 );
23214 rtl8168_mdio_write(tp, 0x13, 0x809A);
23215 ClearAndSetEthPhyBit( tp,
23216 0x14,
23217 0xFF00 ,
23218 0x4B00
23219 );
23220 rtl8168_mdio_write(tp, 0x13, 0x809D);
23221 ClearAndSetEthPhyBit( tp,
23222 0x14,
23223 0x3F00 ,
23224 0x0800
23225 );
23226 rtl8168_mdio_write(tp, 0x13, 0x80A1);
23227 ClearAndSetEthPhyBit( tp,
23228 0x14,
23229 0xFF00 ,
23230 0x7000
23231 );
23232 rtl8168_mdio_write(tp, 0x13, 0x809F);
23233 ClearAndSetEthPhyBit( tp,
23234 0x14,
23235 0x1F00 ,
23236 0x0300
23237 );
23238 rtl8168_mdio_write(tp, 0x13, 0x809E);
23239 ClearAndSetEthPhyBit( tp,
23240 0x14,
23241 0xFF00 ,
23242 0x8800
23243 );
23244
23245 rtl8168_mdio_write(tp, 0x13, 0x80B2);
23246 ClearAndSetEthPhyBit( tp,
23247 0x14,
23248 0xFF00 ,
23249 0x2200
23250 );
23251 rtl8168_mdio_write(tp, 0x13, 0x80AD);
23252 ClearAndSetEthPhyBit( tp,
23253 0x14,
23254 0xF800 ,
23255 0x9800
23256 );
23257 rtl8168_mdio_write(tp, 0x13, 0x80AF);
23258 ClearAndSetEthPhyBit( tp,
23259 0x14,
23260 0x3F00 ,
23261 0x0800
23262 );
23263 rtl8168_mdio_write(tp, 0x13, 0x80B3);
23264 ClearAndSetEthPhyBit( tp,
23265 0x14,
23266 0xFF00 ,
23267 0x6F00
23268 );
23269 rtl8168_mdio_write(tp, 0x13, 0x80B1);
23270 ClearAndSetEthPhyBit( tp,
23271 0x14,
23272 0x1F00 ,
23273 0x0300
23274 );
23275 rtl8168_mdio_write(tp, 0x13, 0x80B0);
23276 ClearAndSetEthPhyBit( tp,
23277 0x14,
23278 0xFF00 ,
23279 0x9300
23280 );
23281 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23282
23283 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23284 rtl8168_mdio_write(tp, 0x13, 0x8011);
23285 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_11);
23286 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23287
23288 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
23289 rtl8168_set_eth_phy_bit(tp, 0x11, BIT_11);
23290 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23291
23292 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23293 rtl8168_mdio_write(tp, 0x13, 0x8016);
23294 rtl8168_set_eth_phy_bit(tp, 0x14, BIT_10);
23295 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23296
23297 if (aspm) {
23298 if (!HW_SUPP_SERDES_PHY(tp) &&
23299 HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
23300 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
23301 rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
23302 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23303 }
23304 }
23305 }
23306
23307 #ifdef ENABLE_FIBER_SUPPORT
23308 if (HW_FIBER_MODE_ENABLED(tp))
23309 rtl8168_hw_fiber_phy_config(dev);
23310 #endif //ENABLE_FIBER_SUPPORT
23311
23312 //EthPhyPPSW
23313 if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
23314 tp->mcfg == CFG_METHOD_24 || tp->mcfg == CFG_METHOD_25 ||
23315 tp->mcfg == CFG_METHOD_26) {
23316 //disable EthPhyPPSW
23317 rtl8168_mdio_write(tp, 0x1F, 0x0BCD);
23318 rtl8168_mdio_write(tp, 0x14, 0x5065);
23319 rtl8168_mdio_write(tp, 0x14, 0xD065);
23320 rtl8168_mdio_write(tp, 0x1F, 0x0BC8);
23321 rtl8168_mdio_write(tp, 0x11, 0x5655);
23322 rtl8168_mdio_write(tp, 0x1F, 0x0BCD);
23323 rtl8168_mdio_write(tp, 0x14, 0x1065);
23324 rtl8168_mdio_write(tp, 0x14, 0x9065);
23325 rtl8168_mdio_write(tp, 0x14, 0x1065);
23326 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23327 } else if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
23328 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
23329 tp->mcfg == CFG_METHOD_33) {
23330 //enable EthPhyPPSW
23331 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
23332 rtl8168_set_eth_phy_bit( tp, 0x11, BIT_7 );
23333 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23334 }
23335
23336 /*ocp phy power saving*/
23337 if (tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
23338 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28 ||
23339 tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30 ||
23340 tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
23341 tp->mcfg == CFG_METHOD_33) {
23342 if (aspm)
23343 rtl8168_enable_ocp_phy_power_saving(dev);
23344 }
23345
23346 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23347
23348 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
23349 if (tp->eee_enabled)
23350 rtl8168_enable_EEE(tp);
23351 else
23352 rtl8168_disable_EEE(tp);
23353 }
23354 }
23355
rtl8168_delete_esd_timer(struct net_device * dev,struct timer_list * timer)23356 static inline void rtl8168_delete_esd_timer(struct net_device *dev, struct timer_list *timer)
23357 {
23358 del_timer_sync(timer);
23359 }
23360
rtl8168_request_esd_timer(struct net_device * dev)23361 static inline void rtl8168_request_esd_timer(struct net_device *dev)
23362 {
23363 struct rtl8168_private *tp = netdev_priv(dev);
23364 struct timer_list *timer = &tp->esd_timer;
23365 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
23366 setup_timer(timer, rtl8168_esd_timer, (unsigned long)dev);
23367 #else
23368 timer_setup(timer, rtl8168_esd_timer, 0);
23369 #endif
23370 mod_timer(timer, jiffies + RTL8168_ESD_TIMEOUT);
23371 }
23372
rtl8168_delete_link_timer(struct net_device * dev,struct timer_list * timer)23373 static inline void rtl8168_delete_link_timer(struct net_device *dev, struct timer_list *timer)
23374 {
23375 del_timer_sync(timer);
23376 }
23377
rtl8168_request_link_timer(struct net_device * dev)23378 static inline void rtl8168_request_link_timer(struct net_device *dev)
23379 {
23380 struct rtl8168_private *tp = netdev_priv(dev);
23381 struct timer_list *timer = &tp->link_timer;
23382
23383 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
23384 setup_timer(timer, rtl8168_link_timer, (unsigned long)dev);
23385 #else
23386 timer_setup(timer, rtl8168_link_timer, 0);
23387 #endif
23388 mod_timer(timer, jiffies + RTL8168_LINK_TIMEOUT);
23389 }
23390
23391 #ifdef CONFIG_NET_POLL_CONTROLLER
23392 /*
23393 * Polling 'interrupt' - used by things like netconsole to send skbs
23394 * without having to re-enable interrupts. It's not called while
23395 * the interrupt routine is executing.
23396 */
23397 static void
rtl8168_netpoll(struct net_device * dev)23398 rtl8168_netpoll(struct net_device *dev)
23399 {
23400 struct rtl8168_private *tp = netdev_priv(dev);
23401 struct pci_dev *pdev = tp->pci_dev;
23402
23403 disable_irq(pdev->irq);
23404 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
23405 rtl8168_interrupt(pdev->irq, dev, NULL);
23406 #else
23407 rtl8168_interrupt(pdev->irq, dev);
23408 #endif
23409 enable_irq(pdev->irq);
23410 }
23411 #endif
23412
23413 static void
rtl8168_get_bios_setting(struct net_device * dev)23414 rtl8168_get_bios_setting(struct net_device *dev)
23415 {
23416 struct rtl8168_private *tp = netdev_priv(dev);
23417
23418 switch (tp->mcfg) {
23419 case CFG_METHOD_9:
23420 case CFG_METHOD_10:
23421 case CFG_METHOD_11:
23422 case CFG_METHOD_12:
23423 case CFG_METHOD_13:
23424 case CFG_METHOD_14:
23425 case CFG_METHOD_15:
23426 case CFG_METHOD_16:
23427 case CFG_METHOD_17:
23428 case CFG_METHOD_18:
23429 case CFG_METHOD_19:
23430 case CFG_METHOD_20:
23431 case CFG_METHOD_21:
23432 case CFG_METHOD_22:
23433 case CFG_METHOD_23:
23434 case CFG_METHOD_24:
23435 case CFG_METHOD_25:
23436 case CFG_METHOD_26:
23437 case CFG_METHOD_27:
23438 case CFG_METHOD_28:
23439 case CFG_METHOD_29:
23440 case CFG_METHOD_30:
23441 case CFG_METHOD_31:
23442 case CFG_METHOD_32:
23443 case CFG_METHOD_33:
23444 tp->bios_setting = RTL_R32(tp, 0x8c);
23445 break;
23446 }
23447 }
23448
23449 static void
rtl8168_set_bios_setting(struct net_device * dev)23450 rtl8168_set_bios_setting(struct net_device *dev)
23451 {
23452 struct rtl8168_private *tp = netdev_priv(dev);
23453
23454 switch (tp->mcfg) {
23455 case CFG_METHOD_9:
23456 case CFG_METHOD_10:
23457 case CFG_METHOD_11:
23458 case CFG_METHOD_12:
23459 case CFG_METHOD_13:
23460 case CFG_METHOD_14:
23461 case CFG_METHOD_15:
23462 case CFG_METHOD_16:
23463 case CFG_METHOD_17:
23464 case CFG_METHOD_18:
23465 case CFG_METHOD_19:
23466 case CFG_METHOD_20:
23467 case CFG_METHOD_21:
23468 case CFG_METHOD_22:
23469 case CFG_METHOD_23:
23470 case CFG_METHOD_24:
23471 case CFG_METHOD_25:
23472 case CFG_METHOD_26:
23473 case CFG_METHOD_27:
23474 case CFG_METHOD_28:
23475 case CFG_METHOD_29:
23476 case CFG_METHOD_30:
23477 case CFG_METHOD_31:
23478 case CFG_METHOD_32:
23479 case CFG_METHOD_33:
23480 RTL_W32(tp, 0x8C, tp->bios_setting);
23481 break;
23482 }
23483 }
23484
23485 static void
rtl8168_init_software_variable(struct net_device * dev)23486 rtl8168_init_software_variable(struct net_device *dev)
23487 {
23488 struct rtl8168_private *tp = netdev_priv(dev);
23489 struct pci_dev *pdev = tp->pci_dev;
23490
23491 rtl8168_get_bios_setting(dev);
23492
23493 switch (tp->mcfg) {
23494 case CFG_METHOD_11:
23495 case CFG_METHOD_12:
23496 case CFG_METHOD_13:
23497 tp->HwSuppDashVer = 1;
23498 break;
23499 case CFG_METHOD_23:
23500 case CFG_METHOD_27:
23501 case CFG_METHOD_28:
23502 tp->HwSuppDashVer = 2;
23503 break;
23504 case CFG_METHOD_31:
23505 case CFG_METHOD_32:
23506 case CFG_METHOD_33:
23507 tp->HwSuppDashVer = 3;
23508 break;
23509 default:
23510 tp->HwSuppDashVer = 0;
23511 break;
23512 }
23513
23514 switch (tp->mcfg) {
23515 case CFG_METHOD_31:
23516 case CFG_METHOD_32:
23517 case CFG_METHOD_33:
23518 tp->HwPkgDet = rtl8168_mac_ocp_read(tp, 0xDC00);
23519 tp->HwPkgDet = (tp->HwPkgDet >> 3) & 0x0F;
23520 break;
23521 }
23522
23523 if (HW_SUPP_SERDES_PHY(tp))
23524 eee_enable = 0;
23525
23526 switch (tp->mcfg) {
23527 case CFG_METHOD_21:
23528 case CFG_METHOD_22:
23529 case CFG_METHOD_23:
23530 case CFG_METHOD_24:
23531 case CFG_METHOD_25:
23532 case CFG_METHOD_26:
23533 case CFG_METHOD_27:
23534 case CFG_METHOD_28:
23535 case CFG_METHOD_29:
23536 case CFG_METHOD_30:
23537 case CFG_METHOD_31:
23538 case CFG_METHOD_32:
23539 case CFG_METHOD_33:
23540 tp->HwSuppNowIsOobVer = 1;
23541 break;
23542 }
23543
23544 switch (tp->mcfg) {
23545 case CFG_METHOD_21:
23546 case CFG_METHOD_22:
23547 case CFG_METHOD_23:
23548 case CFG_METHOD_24:
23549 case CFG_METHOD_25:
23550 case CFG_METHOD_26:
23551 case CFG_METHOD_27:
23552 case CFG_METHOD_28:
23553 case CFG_METHOD_29:
23554 case CFG_METHOD_30:
23555 case CFG_METHOD_31:
23556 case CFG_METHOD_32:
23557 case CFG_METHOD_33:
23558 tp->HwSuppPhyOcpVer = 1;
23559 break;
23560 }
23561
23562 switch (tp->mcfg) {
23563 case CFG_METHOD_29:
23564 case CFG_METHOD_30:
23565 case CFG_METHOD_31:
23566 case CFG_METHOD_32:
23567 case CFG_METHOD_33:
23568 tp->HwSuppUpsVer = 1;
23569 break;
23570 }
23571
23572 switch (tp->mcfg) {
23573 case CFG_METHOD_31:
23574 case CFG_METHOD_32:
23575 case CFG_METHOD_33:
23576 tp->HwPcieSNOffset = 0x16C;
23577 break;
23578 case CFG_METHOD_DEFAULT:
23579 tp->HwPcieSNOffset = 0;
23580 break;
23581 default:
23582 tp->HwPcieSNOffset = 0x164;
23583 break;
23584 }
23585
23586 switch (tp->mcfg) {
23587 case CFG_METHOD_14:
23588 case CFG_METHOD_15:
23589 case CFG_METHOD_16:
23590 case CFG_METHOD_17:
23591 case CFG_METHOD_18:
23592 case CFG_METHOD_19:
23593 case CFG_METHOD_20:
23594 case CFG_METHOD_21:
23595 case CFG_METHOD_22:
23596 case CFG_METHOD_23:
23597 case CFG_METHOD_24:
23598 case CFG_METHOD_25:
23599 case CFG_METHOD_26:
23600 case CFG_METHOD_27:
23601 case CFG_METHOD_28:
23602 case CFG_METHOD_29:
23603 case CFG_METHOD_30:
23604 case CFG_METHOD_31:
23605 case CFG_METHOD_32:
23606 case CFG_METHOD_33:
23607 tp->HwSuppAspmClkIntrLock = 1;
23608 break;
23609 }
23610
23611 if (!aspm || !tp->HwSuppAspmClkIntrLock)
23612 dynamic_aspm = 0;
23613
23614 #ifdef ENABLE_REALWOW_SUPPORT
23615 rtl8168_get_realwow_hw_version(dev);
23616 #endif //ENABLE_REALWOW_SUPPORT
23617
23618 if (HW_DASH_SUPPORT_DASH(tp) && rtl8168_check_dash(tp))
23619 tp->DASH = 1;
23620 else
23621 tp->DASH = 0;
23622
23623 if (tp->DASH) {
23624 if (HW_DASH_SUPPORT_TYPE_3(tp)) {
23625 u64 CmacMemPhysAddress;
23626 void __iomem *cmac_ioaddr = NULL;
23627 struct pci_dev *pdev_cmac;
23628
23629 pdev_cmac = pci_get_slot(pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), 0));
23630
23631 //map CMAC IO space
23632 CmacMemPhysAddress = pci_resource_start(pdev_cmac, 2);
23633
23634 /* ioremap MMIO region */
23635 cmac_ioaddr = ioremap(CmacMemPhysAddress, R8168_REGS_SIZE);
23636
23637 if (cmac_ioaddr == NULL) {
23638 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
23639 if (netif_msg_probe(tp))
23640 dev_err(&pdev->dev, "cannot remap CMAC MMIO, aborting\n");
23641 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
23642 tp->DASH = 0;
23643 } else {
23644 tp->mapped_cmac_ioaddr = cmac_ioaddr;
23645 }
23646 }
23647
23648 eee_enable = 0;
23649 }
23650
23651 #ifdef ENABLE_DASH_SUPPORT
23652 #ifdef ENABLE_DASH_PRINTER_SUPPORT
23653 if (tp->DASH) {
23654 if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x0F)
23655 tp->dash_printer_enabled = 1;
23656 else if (HW_DASH_SUPPORT_TYPE_2(tp))
23657 tp->dash_printer_enabled = 1;
23658 }
23659 #endif //ENABLE_DASH_PRINTER_SUPPORT
23660 #endif //ENABLE_DASH_SUPPORT
23661
23662 if (HW_DASH_SUPPORT_TYPE_2(tp))
23663 tp->cmac_ioaddr = tp->mmio_addr;
23664 else if (HW_DASH_SUPPORT_TYPE_3(tp))
23665 tp->cmac_ioaddr = tp->mapped_cmac_ioaddr;
23666
23667 switch (tp->mcfg) {
23668 case CFG_METHOD_1:
23669 tp->intr_mask = RxDescUnavail | RxFIFOOver | TxDescUnavail | TxOK | RxOK | SWInt;
23670 tp->timer_intr_mask = PCSTimeout | RxFIFOOver;
23671 break;
23672 case CFG_METHOD_2:
23673 case CFG_METHOD_3:
23674 case CFG_METHOD_4:
23675 tp->intr_mask = RxDescUnavail | TxDescUnavail | TxOK | RxOK | SWInt;
23676 tp->timer_intr_mask = PCSTimeout;
23677 break;
23678 default:
23679 tp->intr_mask = RxDescUnavail | TxOK | RxOK | SWInt;
23680 tp->timer_intr_mask = PCSTimeout;
23681 break;
23682 }
23683
23684 #ifdef ENABLE_DASH_SUPPORT
23685 if (tp->DASH) {
23686 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
23687 tp->timer_intr_mask |= ( ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
23688 tp->intr_mask |= ( ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
23689 } else {
23690 tp->timer_intr_mask |= ( ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK );
23691 tp->intr_mask |= ( ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK );
23692 }
23693 }
23694 #endif
23695 if (aspm) {
23696 switch (tp->mcfg) {
23697 case CFG_METHOD_21:
23698 case CFG_METHOD_22:
23699 case CFG_METHOD_23:
23700 case CFG_METHOD_24:
23701 case CFG_METHOD_25:
23702 case CFG_METHOD_26:
23703 case CFG_METHOD_27:
23704 case CFG_METHOD_28:
23705 case CFG_METHOD_29:
23706 case CFG_METHOD_30:
23707 case CFG_METHOD_31:
23708 case CFG_METHOD_32:
23709 case CFG_METHOD_33:
23710 tp->org_pci_offset_99 = rtl8168_csi_fun0_read_byte(tp, 0x99);
23711 tp->org_pci_offset_99 &= ~(BIT_5|BIT_6);
23712 break;
23713 }
23714 switch (tp->mcfg) {
23715 case CFG_METHOD_24:
23716 case CFG_METHOD_25:
23717 case CFG_METHOD_26:
23718 case CFG_METHOD_27:
23719 case CFG_METHOD_28:
23720 case CFG_METHOD_29:
23721 case CFG_METHOD_30:
23722 tp->org_pci_offset_180 = rtl8168_csi_fun0_read_byte(tp, 0x180);
23723 break;
23724 case CFG_METHOD_31:
23725 case CFG_METHOD_32:
23726 case CFG_METHOD_33:
23727 tp->org_pci_offset_180 = rtl8168_csi_fun0_read_byte(tp, 0x214);
23728 break;
23729 }
23730
23731 switch (tp->mcfg) {
23732 case CFG_METHOD_21:
23733 case CFG_METHOD_22:
23734 case CFG_METHOD_23:
23735 case CFG_METHOD_24:
23736 case CFG_METHOD_25:
23737 case CFG_METHOD_27:
23738 case CFG_METHOD_28:
23739 if (tp->org_pci_offset_99 & BIT_2)
23740 tp->issue_offset_99_event = TRUE;
23741 break;
23742 }
23743 }
23744
23745 pci_read_config_byte(pdev, 0x80, &tp->org_pci_offset_80);
23746 pci_read_config_byte(pdev, 0x81, &tp->org_pci_offset_81);
23747
23748 switch (tp->mcfg) {
23749 case CFG_METHOD_16:
23750 case CFG_METHOD_17:
23751 case CFG_METHOD_18:
23752 case CFG_METHOD_19:
23753 case CFG_METHOD_20:
23754 case CFG_METHOD_21:
23755 case CFG_METHOD_22:
23756 case CFG_METHOD_23:
23757 case CFG_METHOD_24:
23758 case CFG_METHOD_25:
23759 case CFG_METHOD_26:
23760 case CFG_METHOD_27:
23761 if ((tp->features & RTL_FEATURE_MSI) && (tp->org_pci_offset_80 & BIT_1))
23762 tp->use_timer_interrrupt = FALSE;
23763 else
23764 tp->use_timer_interrrupt = TRUE;
23765 break;
23766 default:
23767 tp->use_timer_interrrupt = TRUE;
23768 break;
23769 }
23770
23771 if (timer_count == 0 || tp->mcfg == CFG_METHOD_DEFAULT)
23772 tp->use_timer_interrrupt = FALSE;
23773
23774 switch (tp->mcfg) {
23775 case CFG_METHOD_1:
23776 case CFG_METHOD_2:
23777 case CFG_METHOD_3:
23778 tp->ShortPacketSwChecksum = TRUE;
23779 break;
23780 case CFG_METHOD_16:
23781 case CFG_METHOD_17:
23782 tp->ShortPacketSwChecksum = TRUE;
23783 tp->UseSwPaddingShortPkt = TRUE;
23784 break;
23785 }
23786
23787 switch (tp->mcfg) {
23788 case CFG_METHOD_30: {
23789 u16 ioffset_p3, ioffset_p2, ioffset_p1, ioffset_p0;
23790 u16 TmpUshort;
23791
23792 rtl8168_mac_ocp_write( tp, 0xDD02, 0x807D);
23793 TmpUshort = rtl8168_mac_ocp_read( tp, 0xDD02 );
23794 ioffset_p3 = ( (TmpUshort & BIT_7) >>7 );
23795 ioffset_p3 <<= 3;
23796 TmpUshort = rtl8168_mac_ocp_read( tp, 0xDD00 );
23797
23798 ioffset_p3 |= ((TmpUshort & (BIT_15 | BIT_14 | BIT_13))>>13);
23799
23800 ioffset_p2 = ((TmpUshort & (BIT_12|BIT_11|BIT_10|BIT_9))>>9);
23801 ioffset_p1 = ((TmpUshort & (BIT_8|BIT_7|BIT_6|BIT_5))>>5);
23802
23803 ioffset_p0 = ( (TmpUshort & BIT_4) >>4 );
23804 ioffset_p0 <<= 3;
23805 ioffset_p0 |= (TmpUshort & (BIT_2| BIT_1 | BIT_0));
23806
23807 if ((ioffset_p3 == 0x0F) && (ioffset_p2 == 0x0F) && (ioffset_p1 == 0x0F) && (ioffset_p0 == 0x0F)) {
23808 tp->RequireAdcBiasPatch = FALSE;
23809 } else {
23810 tp->RequireAdcBiasPatch = TRUE;
23811 tp->AdcBiasPatchIoffset = (ioffset_p3<<12)|(ioffset_p2<<8)|(ioffset_p1<<4)|(ioffset_p0);
23812 }
23813 }
23814 break;
23815 }
23816
23817 switch (tp->mcfg) {
23818 case CFG_METHOD_29:
23819 case CFG_METHOD_30:
23820 case CFG_METHOD_31:
23821 case CFG_METHOD_32:
23822 case CFG_METHOD_33: {
23823 u16 rg_saw_cnt;
23824
23825 rtl8168_mdio_write(tp, 0x1F, 0x0C42);
23826 rg_saw_cnt = rtl8168_mdio_read(tp, 0x13);
23827 rg_saw_cnt &= ~(BIT_15|BIT_14);
23828 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23829
23830 if ( rg_saw_cnt > 0) {
23831 tp->SwrCnt1msIni = 16000000/rg_saw_cnt;
23832 tp->SwrCnt1msIni &= 0x0FFF;
23833
23834 tp->RequireAdjustUpsTxLinkPulseTiming = TRUE;
23835 }
23836 }
23837 break;
23838 }
23839
23840 #ifdef ENABLE_FIBER_SUPPORT
23841 rtl8168_check_hw_fiber_mode_support(dev);
23842 #endif //ENABLE_FIBER_SUPPORT
23843
23844 switch(tp->mcfg) {
23845 case CFG_METHOD_32:
23846 case CFG_METHOD_33:
23847 if (tp->HwPkgDet == 0x06) {
23848 u8 tmpUchar = rtl8168_eri_read(tp, 0xE6, 1, ERIAR_ExGMAC);
23849 if (tmpUchar == 0x02)
23850 tp->HwSuppSerDesPhyVer = 1;
23851 else if (tmpUchar == 0x00)
23852 tp->HwSuppSerDesPhyVer = 2;
23853 }
23854 break;
23855 }
23856
23857 if (pdev->subsystem_vendor == 0x144d) {
23858 if (pdev->subsystem_device == 0xc098 ||
23859 pdev->subsystem_device == 0xc0b1 ||
23860 pdev->subsystem_device == 0xc0b8)
23861 hwoptimize |= HW_PATCH_SAMSUNG_LAN_DONGLE;
23862 }
23863
23864 if (hwoptimize & HW_PATCH_SAMSUNG_LAN_DONGLE) {
23865 switch (tp->mcfg) {
23866 case CFG_METHOD_14:
23867 case CFG_METHOD_15:
23868 case CFG_METHOD_16:
23869 case CFG_METHOD_17:
23870 case CFG_METHOD_18:
23871 case CFG_METHOD_19:
23872 case CFG_METHOD_20:
23873 case CFG_METHOD_30:
23874 tp->RequiredSecLanDonglePatch = TRUE;
23875 break;
23876 }
23877 }
23878
23879 switch (tp->mcfg) {
23880 case CFG_METHOD_16:
23881 case CFG_METHOD_17:
23882 case CFG_METHOD_18:
23883 case CFG_METHOD_19:
23884 case CFG_METHOD_20:
23885 case CFG_METHOD_21:
23886 case CFG_METHOD_22:
23887 case CFG_METHOD_24:
23888 case CFG_METHOD_25:
23889 case CFG_METHOD_26:
23890 case CFG_METHOD_27:
23891 case CFG_METHOD_28:
23892 case CFG_METHOD_29:
23893 case CFG_METHOD_30:
23894 case CFG_METHOD_31:
23895 case CFG_METHOD_32:
23896 case CFG_METHOD_33:
23897 tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_V2;
23898 break;
23899 case CFG_METHOD_DEFAULT:
23900 tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_NOT_SUPPORT;
23901 break;
23902 default:
23903 tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_V1;
23904 break;
23905 }
23906
23907 switch (tp->mcfg) {
23908 case CFG_METHOD_29:
23909 case CFG_METHOD_30:
23910 tp->HwSuppEsdVer = 2;
23911 break;
23912 default:
23913 tp->HwSuppEsdVer = 1;
23914 break;
23915 }
23916
23917 if (tp->HwSuppEsdVer == 2) {
23918 rtl8168_mdio_write(tp, 0x1F, 0x0A46);
23919 tp->BackupPhyFuseDout_15_0 = rtl8168_mdio_read(tp, 0x10);
23920 tp->BackupPhyFuseDout_47_32 = rtl8168_mdio_read(tp, 0x12);
23921 tp->BackupPhyFuseDout_63_48 = rtl8168_mdio_read(tp, 0x13);
23922 rtl8168_mdio_write(tp, 0x1F, 0x0000);
23923
23924 tp->TestPhyOcpReg = TRUE;
23925 }
23926
23927 switch (tp->mcfg) {
23928 case CFG_METHOD_16:
23929 case CFG_METHOD_17:
23930 tp->HwSuppCheckPhyDisableModeVer = 1;
23931 break;
23932 case CFG_METHOD_18:
23933 case CFG_METHOD_19:
23934 case CFG_METHOD_21:
23935 case CFG_METHOD_22:
23936 case CFG_METHOD_24:
23937 case CFG_METHOD_25:
23938 case CFG_METHOD_26:
23939 case CFG_METHOD_29:
23940 case CFG_METHOD_30:
23941 tp->HwSuppCheckPhyDisableModeVer = 2;
23942 break;
23943 case CFG_METHOD_23:
23944 case CFG_METHOD_27:
23945 case CFG_METHOD_28:
23946 case CFG_METHOD_31:
23947 case CFG_METHOD_32:
23948 case CFG_METHOD_33:
23949 tp->HwSuppCheckPhyDisableModeVer = 3;
23950 break;
23951 }
23952
23953 switch (tp->mcfg) {
23954 case CFG_METHOD_14:
23955 case CFG_METHOD_15:
23956 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_14;
23957 break;
23958 case CFG_METHOD_16:
23959 case CFG_METHOD_17:
23960 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_16;
23961 break;
23962 case CFG_METHOD_18:
23963 case CFG_METHOD_19:
23964 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_18;
23965 break;
23966 case CFG_METHOD_20:
23967 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_20;
23968 break;
23969 case CFG_METHOD_21:
23970 case CFG_METHOD_22:
23971 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_21;
23972 break;
23973 case CFG_METHOD_23:
23974 case CFG_METHOD_27:
23975 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_23;
23976 break;
23977 case CFG_METHOD_24:
23978 case CFG_METHOD_25:
23979 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_24;
23980 break;
23981 case CFG_METHOD_26:
23982 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_26;
23983 break;
23984 case CFG_METHOD_28:
23985 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_28;
23986 break;
23987 case CFG_METHOD_29:
23988 case CFG_METHOD_30:
23989 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_29;
23990 break;
23991 case CFG_METHOD_31:
23992 case CFG_METHOD_32:
23993 case CFG_METHOD_33:
23994 tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_31;
23995 break;
23996 }
23997
23998 if (tp->HwIcVerUnknown) {
23999 tp->NotWrRamCodeToMicroP = TRUE;
24000 tp->NotWrMcuPatchCode = TRUE;
24001 }
24002
24003 tp->NicCustLedValue = RTL_R16(tp, CustomLED);
24004
24005 rtl8168_get_hw_wol(dev);
24006
24007 rtl8168_link_option((u8*)&autoneg_mode, (u32*)&speed_mode, (u8*)&duplex_mode, (u32*)&advertising_mode);
24008
24009 tp->autoneg = autoneg_mode;
24010 tp->speed = speed_mode;
24011 tp->duplex = duplex_mode;
24012 tp->advertising = advertising_mode;
24013
24014 tp->max_jumbo_frame_size = rtl_chip_info[tp->chipset].jumbo_frame_sz;
24015 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
24016 /* MTU range: 60 - hw-specific max */
24017 dev->min_mtu = ETH_MIN_MTU;
24018 dev->max_mtu = tp->max_jumbo_frame_size;
24019 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
24020 tp->eee_enabled = eee_enable;
24021 tp->eee_adv_t = MDIO_EEE_1000T | MDIO_EEE_100TX;
24022
24023 #ifdef ENABLE_FIBER_SUPPORT
24024 if (HW_FIBER_MODE_ENABLED(tp))
24025 rtl8168_set_fiber_mode_software_variable(dev);
24026 #endif //ENABLE_FIBER_SUPPORT
24027 }
24028
24029 static void
rtl8168_release_board(struct pci_dev * pdev,struct net_device * dev)24030 rtl8168_release_board(struct pci_dev *pdev,
24031 struct net_device *dev)
24032 {
24033 struct rtl8168_private *tp = netdev_priv(dev);
24034 void __iomem *ioaddr = tp->mmio_addr;
24035
24036 rtl8168_set_bios_setting(dev);
24037 rtl8168_rar_set(tp, tp->org_mac_addr);
24038 tp->wol_enabled = WOL_DISABLED;
24039
24040 if (!tp->DASH)
24041 rtl8168_phy_power_down(dev);
24042
24043 #ifdef ENABLE_DASH_SUPPORT
24044 if (tp->DASH)
24045 FreeAllocatedDashShareMemory(dev);
24046 #endif
24047
24048 if (tp->mapped_cmac_ioaddr != NULL)
24049 iounmap(tp->mapped_cmac_ioaddr);
24050
24051 iounmap(ioaddr);
24052 pci_release_regions(pdev);
24053 pci_clear_mwi(pdev);
24054 pci_disable_device(pdev);
24055 free_netdev(dev);
24056 }
24057
24058 static int
rtl8168_get_mac_address(struct net_device * dev)24059 rtl8168_get_mac_address(struct net_device *dev)
24060 {
24061 struct rtl8168_private *tp = netdev_priv(dev);
24062 int i;
24063 u8 mac_addr[MAC_ADDR_LEN];
24064
24065 for (i = 0; i < MAC_ADDR_LEN; i++)
24066 mac_addr[i] = RTL_R8(tp, MAC0 + i);
24067
24068 if (tp->mcfg == CFG_METHOD_18 ||
24069 tp->mcfg == CFG_METHOD_19 ||
24070 tp->mcfg == CFG_METHOD_20 ||
24071 tp->mcfg == CFG_METHOD_21 ||
24072 tp->mcfg == CFG_METHOD_22 ||
24073 tp->mcfg == CFG_METHOD_23 ||
24074 tp->mcfg == CFG_METHOD_24 ||
24075 tp->mcfg == CFG_METHOD_25 ||
24076 tp->mcfg == CFG_METHOD_26 ||
24077 tp->mcfg == CFG_METHOD_27 ||
24078 tp->mcfg == CFG_METHOD_28 ||
24079 tp->mcfg == CFG_METHOD_29 ||
24080 tp->mcfg == CFG_METHOD_30 ||
24081 tp->mcfg == CFG_METHOD_31 ||
24082 tp->mcfg == CFG_METHOD_32 ||
24083 tp->mcfg == CFG_METHOD_33) {
24084 *(u32*)&mac_addr[0] = rtl8168_eri_read(tp, 0xE0, 4, ERIAR_ExGMAC);
24085 *(u16*)&mac_addr[4] = rtl8168_eri_read(tp, 0xE4, 2, ERIAR_ExGMAC);
24086 } else {
24087 if (tp->eeprom_type != EEPROM_TYPE_NONE) {
24088 u16 *pUshort = (u16*)mac_addr;
24089 /* Get MAC address from EEPROM */
24090 if (tp->mcfg == CFG_METHOD_16 ||
24091 tp->mcfg == CFG_METHOD_17 ||
24092 tp->mcfg == CFG_METHOD_18 ||
24093 tp->mcfg == CFG_METHOD_19 ||
24094 tp->mcfg == CFG_METHOD_20 ||
24095 tp->mcfg == CFG_METHOD_21 ||
24096 tp->mcfg == CFG_METHOD_22 ||
24097 tp->mcfg == CFG_METHOD_23 ||
24098 tp->mcfg == CFG_METHOD_24 ||
24099 tp->mcfg == CFG_METHOD_25 ||
24100 tp->mcfg == CFG_METHOD_26 ||
24101 tp->mcfg == CFG_METHOD_27 ||
24102 tp->mcfg == CFG_METHOD_28 ||
24103 tp->mcfg == CFG_METHOD_29 ||
24104 tp->mcfg == CFG_METHOD_30 ||
24105 tp->mcfg == CFG_METHOD_31 ||
24106 tp->mcfg == CFG_METHOD_32 ||
24107 tp->mcfg == CFG_METHOD_33) {
24108 *pUshort++ = rtl8168_eeprom_read_sc(tp, 1);
24109 *pUshort++ = rtl8168_eeprom_read_sc(tp, 2);
24110 *pUshort = rtl8168_eeprom_read_sc(tp, 3);
24111 } else {
24112 *pUshort++ = rtl8168_eeprom_read_sc(tp, 7);
24113 *pUshort++ = rtl8168_eeprom_read_sc(tp, 8);
24114 *pUshort = rtl8168_eeprom_read_sc(tp, 9);
24115 }
24116 }
24117 }
24118
24119 if (!is_valid_ether_addr(mac_addr)) {
24120 netif_err(tp, probe, dev, "Invalid ether addr %pM\n",
24121 mac_addr);
24122 eth_hw_addr_random(dev);
24123 ether_addr_copy(mac_addr, dev->dev_addr);
24124 netif_info(tp, probe, dev, "Random ether addr %pM\n",
24125 mac_addr);
24126 tp->random_mac = 1;
24127 }
24128
24129 rtl8168_rar_set(tp, mac_addr);
24130
24131 for (i = 0; i < MAC_ADDR_LEN; i++) {
24132 dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
24133 tp->org_mac_addr[i] = dev->dev_addr[i]; /* keep the original MAC address */
24134 }
24135 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
24136 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
24137 #endif
24138 // memcpy(dev->dev_addr, dev->dev_addr, dev->addr_len);
24139
24140 return 0;
24141 }
24142
24143 /**
24144 * rtl8168_set_mac_address - Change the Ethernet Address of the NIC
24145 * @dev: network interface device structure
24146 * @p: pointer to an address structure
24147 *
24148 * Return 0 on success, negative on failure
24149 **/
24150 static int
rtl8168_set_mac_address(struct net_device * dev,void * p)24151 rtl8168_set_mac_address(struct net_device *dev,
24152 void *p)
24153 {
24154 struct rtl8168_private *tp = netdev_priv(dev);
24155 struct sockaddr *addr = p;
24156 unsigned long flags;
24157
24158 if (!is_valid_ether_addr(addr->sa_data))
24159 return -EADDRNOTAVAIL;
24160
24161 spin_lock_irqsave(&tp->lock, flags);
24162
24163 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
24164
24165 rtl8168_rar_set(tp, dev->dev_addr);
24166
24167 spin_unlock_irqrestore(&tp->lock, flags);
24168
24169 return 0;
24170 }
24171
24172 /******************************************************************************
24173 * rtl8168_rar_set - Puts an ethernet address into a receive address register.
24174 *
24175 * tp - The private data structure for driver
24176 * addr - Address to put into receive address register
24177 *****************************************************************************/
24178 void
rtl8168_rar_set(struct rtl8168_private * tp,uint8_t * addr)24179 rtl8168_rar_set(struct rtl8168_private *tp,
24180 uint8_t *addr)
24181 {
24182 uint32_t rar_low = 0;
24183 uint32_t rar_high = 0;
24184
24185 rar_low = ((uint32_t) addr[0] |
24186 ((uint32_t) addr[1] << 8) |
24187 ((uint32_t) addr[2] << 16) |
24188 ((uint32_t) addr[3] << 24));
24189
24190 rar_high = ((uint32_t) addr[4] |
24191 ((uint32_t) addr[5] << 8));
24192
24193 rtl8168_enable_cfg9346_write(tp);
24194 RTL_W32(tp, MAC0, rar_low);
24195 RTL_W32(tp, MAC4, rar_high);
24196
24197 switch (tp->mcfg) {
24198 case CFG_METHOD_14:
24199 case CFG_METHOD_15:
24200 RTL_W32(tp, SecMAC0, rar_low);
24201 RTL_W16(tp, SecMAC4, (uint16_t)rar_high);
24202 break;
24203 }
24204
24205 if (tp->mcfg == CFG_METHOD_17) {
24206 rtl8168_eri_write(tp, 0xf0, 4, rar_low << 16, ERIAR_ExGMAC);
24207 rtl8168_eri_write(tp, 0xf4, 4, rar_low >> 16 | rar_high << 16, ERIAR_ExGMAC);
24208 }
24209
24210 rtl8168_disable_cfg9346_write(tp);
24211 }
24212
24213 #ifdef ETHTOOL_OPS_COMPAT
ethtool_get_settings(struct net_device * dev,void * useraddr)24214 static int ethtool_get_settings(struct net_device *dev, void *useraddr)
24215 {
24216 struct ethtool_cmd cmd = { ETHTOOL_GSET };
24217 int err;
24218
24219 if (!ethtool_ops->get_settings)
24220 return -EOPNOTSUPP;
24221
24222 err = ethtool_ops->get_settings(dev, &cmd);
24223 if (err < 0)
24224 return err;
24225
24226 if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
24227 return -EFAULT;
24228 return 0;
24229 }
24230
ethtool_set_settings(struct net_device * dev,void * useraddr)24231 static int ethtool_set_settings(struct net_device *dev, void *useraddr)
24232 {
24233 struct ethtool_cmd cmd;
24234
24235 if (!ethtool_ops->set_settings)
24236 return -EOPNOTSUPP;
24237
24238 if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
24239 return -EFAULT;
24240
24241 return ethtool_ops->set_settings(dev, &cmd);
24242 }
24243
ethtool_get_drvinfo(struct net_device * dev,void * useraddr)24244 static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr)
24245 {
24246 struct ethtool_drvinfo info;
24247 struct ethtool_ops *ops = ethtool_ops;
24248
24249 if (!ops->get_drvinfo)
24250 return -EOPNOTSUPP;
24251
24252 memset(&info, 0, sizeof(info));
24253 info.cmd = ETHTOOL_GDRVINFO;
24254 ops->get_drvinfo(dev, &info);
24255
24256 if (ops->self_test_count)
24257 info.testinfo_len = ops->self_test_count(dev);
24258 if (ops->get_stats_count)
24259 info.n_stats = ops->get_stats_count(dev);
24260 if (ops->get_regs_len)
24261 info.regdump_len = ops->get_regs_len(dev);
24262 if (ops->get_eeprom_len)
24263 info.eedump_len = ops->get_eeprom_len(dev);
24264
24265 if (copy_to_user(useraddr, &info, sizeof(info)))
24266 return -EFAULT;
24267 return 0;
24268 }
24269
ethtool_get_regs(struct net_device * dev,char * useraddr)24270 static int ethtool_get_regs(struct net_device *dev, char *useraddr)
24271 {
24272 struct ethtool_regs regs;
24273 struct ethtool_ops *ops = ethtool_ops;
24274 void *regbuf;
24275 int reglen, ret;
24276
24277 if (!ops->get_regs || !ops->get_regs_len)
24278 return -EOPNOTSUPP;
24279
24280 if (copy_from_user(®s, useraddr, sizeof(regs)))
24281 return -EFAULT;
24282
24283 reglen = ops->get_regs_len(dev);
24284 if (regs.len > reglen)
24285 regs.len = reglen;
24286
24287 regbuf = kmalloc(reglen, GFP_USER);
24288 if (!regbuf)
24289 return -ENOMEM;
24290
24291 ops->get_regs(dev, ®s, regbuf);
24292
24293 ret = -EFAULT;
24294 if (copy_to_user(useraddr, ®s, sizeof(regs)))
24295 goto out;
24296 useraddr += offsetof(struct ethtool_regs, data);
24297 if (copy_to_user(useraddr, regbuf, reglen))
24298 goto out;
24299 ret = 0;
24300
24301 out:
24302 kfree(regbuf);
24303 return ret;
24304 }
24305
ethtool_get_wol(struct net_device * dev,char * useraddr)24306 static int ethtool_get_wol(struct net_device *dev, char *useraddr)
24307 {
24308 struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
24309
24310 if (!ethtool_ops->get_wol)
24311 return -EOPNOTSUPP;
24312
24313 ethtool_ops->get_wol(dev, &wol);
24314
24315 if (copy_to_user(useraddr, &wol, sizeof(wol)))
24316 return -EFAULT;
24317 return 0;
24318 }
24319
ethtool_set_wol(struct net_device * dev,char * useraddr)24320 static int ethtool_set_wol(struct net_device *dev, char *useraddr)
24321 {
24322 struct ethtool_wolinfo wol;
24323
24324 if (!ethtool_ops->set_wol)
24325 return -EOPNOTSUPP;
24326
24327 if (copy_from_user(&wol, useraddr, sizeof(wol)))
24328 return -EFAULT;
24329
24330 return ethtool_ops->set_wol(dev, &wol);
24331 }
24332
ethtool_get_msglevel(struct net_device * dev,char * useraddr)24333 static int ethtool_get_msglevel(struct net_device *dev, char *useraddr)
24334 {
24335 struct ethtool_value edata = { ETHTOOL_GMSGLVL };
24336
24337 if (!ethtool_ops->get_msglevel)
24338 return -EOPNOTSUPP;
24339
24340 edata.data = ethtool_ops->get_msglevel(dev);
24341
24342 if (copy_to_user(useraddr, &edata, sizeof(edata)))
24343 return -EFAULT;
24344 return 0;
24345 }
24346
ethtool_set_msglevel(struct net_device * dev,char * useraddr)24347 static int ethtool_set_msglevel(struct net_device *dev, char *useraddr)
24348 {
24349 struct ethtool_value edata;
24350
24351 if (!ethtool_ops->set_msglevel)
24352 return -EOPNOTSUPP;
24353
24354 if (copy_from_user(&edata, useraddr, sizeof(edata)))
24355 return -EFAULT;
24356
24357 ethtool_ops->set_msglevel(dev, edata.data);
24358 return 0;
24359 }
24360
ethtool_nway_reset(struct net_device * dev)24361 static int ethtool_nway_reset(struct net_device *dev)
24362 {
24363 if (!ethtool_ops->nway_reset)
24364 return -EOPNOTSUPP;
24365
24366 return ethtool_ops->nway_reset(dev);
24367 }
24368
ethtool_get_link(struct net_device * dev,void * useraddr)24369 static int ethtool_get_link(struct net_device *dev, void *useraddr)
24370 {
24371 struct ethtool_value edata = { ETHTOOL_GLINK };
24372
24373 if (!ethtool_ops->get_link)
24374 return -EOPNOTSUPP;
24375
24376 edata.data = ethtool_ops->get_link(dev);
24377
24378 if (copy_to_user(useraddr, &edata, sizeof(edata)))
24379 return -EFAULT;
24380 return 0;
24381 }
24382
ethtool_get_eeprom(struct net_device * dev,void * useraddr)24383 static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
24384 {
24385 struct ethtool_eeprom eeprom;
24386 struct ethtool_ops *ops = ethtool_ops;
24387 u8 *data;
24388 int ret;
24389
24390 if (!ops->get_eeprom || !ops->get_eeprom_len)
24391 return -EOPNOTSUPP;
24392
24393 if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
24394 return -EFAULT;
24395
24396 /* Check for wrap and zero */
24397 if (eeprom.offset + eeprom.len <= eeprom.offset)
24398 return -EINVAL;
24399
24400 /* Check for exceeding total eeprom len */
24401 if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
24402 return -EINVAL;
24403
24404 data = kmalloc(eeprom.len, GFP_USER);
24405 if (!data)
24406 return -ENOMEM;
24407
24408 ret = -EFAULT;
24409 if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
24410 goto out;
24411
24412 ret = ops->get_eeprom(dev, &eeprom, data);
24413 if (ret)
24414 goto out;
24415
24416 ret = -EFAULT;
24417 if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
24418 goto out;
24419 if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
24420 goto out;
24421 ret = 0;
24422
24423 out:
24424 kfree(data);
24425 return ret;
24426 }
24427
ethtool_set_eeprom(struct net_device * dev,void * useraddr)24428 static int ethtool_set_eeprom(struct net_device *dev, void *useraddr)
24429 {
24430 struct ethtool_eeprom eeprom;
24431 struct ethtool_ops *ops = ethtool_ops;
24432 u8 *data;
24433 int ret;
24434
24435 if (!ops->set_eeprom || !ops->get_eeprom_len)
24436 return -EOPNOTSUPP;
24437
24438 if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
24439 return -EFAULT;
24440
24441 /* Check for wrap and zero */
24442 if (eeprom.offset + eeprom.len <= eeprom.offset)
24443 return -EINVAL;
24444
24445 /* Check for exceeding total eeprom len */
24446 if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
24447 return -EINVAL;
24448
24449 data = kmalloc(eeprom.len, GFP_USER);
24450 if (!data)
24451 return -ENOMEM;
24452
24453 ret = -EFAULT;
24454 if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
24455 goto out;
24456
24457 ret = ops->set_eeprom(dev, &eeprom, data);
24458 if (ret)
24459 goto out;
24460
24461 if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
24462 ret = -EFAULT;
24463
24464 out:
24465 kfree(data);
24466 return ret;
24467 }
24468
ethtool_get_coalesce(struct net_device * dev,void * useraddr)24469 static int ethtool_get_coalesce(struct net_device *dev, void *useraddr)
24470 {
24471 struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE };
24472
24473 if (!ethtool_ops->get_coalesce)
24474 return -EOPNOTSUPP;
24475
24476 ethtool_ops->get_coalesce(dev, &coalesce);
24477
24478 if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
24479 return -EFAULT;
24480 return 0;
24481 }
24482
ethtool_set_coalesce(struct net_device * dev,void * useraddr)24483 static int ethtool_set_coalesce(struct net_device *dev, void *useraddr)
24484 {
24485 struct ethtool_coalesce coalesce;
24486
24487 if (!ethtool_ops->get_coalesce)
24488 return -EOPNOTSUPP;
24489
24490 if (copy_from_user(&coalesce, useraddr, sizeof(coalesce)))
24491 return -EFAULT;
24492
24493 return ethtool_ops->set_coalesce(dev, &coalesce);
24494 }
24495
ethtool_get_ringparam(struct net_device * dev,void * useraddr)24496 static int ethtool_get_ringparam(struct net_device *dev, void *useraddr)
24497 {
24498 struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM };
24499
24500 if (!ethtool_ops->get_ringparam)
24501 return -EOPNOTSUPP;
24502
24503 ethtool_ops->get_ringparam(dev, &ringparam);
24504
24505 if (copy_to_user(useraddr, &ringparam, sizeof(ringparam)))
24506 return -EFAULT;
24507 return 0;
24508 }
24509
ethtool_set_ringparam(struct net_device * dev,void * useraddr)24510 static int ethtool_set_ringparam(struct net_device *dev, void *useraddr)
24511 {
24512 struct ethtool_ringparam ringparam;
24513
24514 if (!ethtool_ops->get_ringparam)
24515 return -EOPNOTSUPP;
24516
24517 if (copy_from_user(&ringparam, useraddr, sizeof(ringparam)))
24518 return -EFAULT;
24519
24520 return ethtool_ops->set_ringparam(dev, &ringparam);
24521 }
24522
ethtool_get_pauseparam(struct net_device * dev,void * useraddr)24523 static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr)
24524 {
24525 struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
24526
24527 if (!ethtool_ops->get_pauseparam)
24528 return -EOPNOTSUPP;
24529
24530 ethtool_ops->get_pauseparam(dev, &pauseparam);
24531
24532 if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam)))
24533 return -EFAULT;
24534 return 0;
24535 }
24536
ethtool_set_pauseparam(struct net_device * dev,void * useraddr)24537 static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr)
24538 {
24539 struct ethtool_pauseparam pauseparam;
24540
24541 if (!ethtool_ops->get_pauseparam)
24542 return -EOPNOTSUPP;
24543
24544 if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam)))
24545 return -EFAULT;
24546
24547 return ethtool_ops->set_pauseparam(dev, &pauseparam);
24548 }
24549
ethtool_get_rx_csum(struct net_device * dev,char * useraddr)24550 static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr)
24551 {
24552 struct ethtool_value edata = { ETHTOOL_GRXCSUM };
24553
24554 if (!ethtool_ops->get_rx_csum)
24555 return -EOPNOTSUPP;
24556
24557 edata.data = ethtool_ops->get_rx_csum(dev);
24558
24559 if (copy_to_user(useraddr, &edata, sizeof(edata)))
24560 return -EFAULT;
24561 return 0;
24562 }
24563
ethtool_set_rx_csum(struct net_device * dev,char * useraddr)24564 static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr)
24565 {
24566 struct ethtool_value edata;
24567
24568 if (!ethtool_ops->set_rx_csum)
24569 return -EOPNOTSUPP;
24570
24571 if (copy_from_user(&edata, useraddr, sizeof(edata)))
24572 return -EFAULT;
24573
24574 ethtool_ops->set_rx_csum(dev, edata.data);
24575 return 0;
24576 }
24577
ethtool_get_tx_csum(struct net_device * dev,char * useraddr)24578 static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr)
24579 {
24580 struct ethtool_value edata = { ETHTOOL_GTXCSUM };
24581
24582 if (!ethtool_ops->get_tx_csum)
24583 return -EOPNOTSUPP;
24584
24585 edata.data = ethtool_ops->get_tx_csum(dev);
24586
24587 if (copy_to_user(useraddr, &edata, sizeof(edata)))
24588 return -EFAULT;
24589 return 0;
24590 }
24591
ethtool_set_tx_csum(struct net_device * dev,char * useraddr)24592 static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr)
24593 {
24594 struct ethtool_value edata;
24595
24596 if (!ethtool_ops->set_tx_csum)
24597 return -EOPNOTSUPP;
24598
24599 if (copy_from_user(&edata, useraddr, sizeof(edata)))
24600 return -EFAULT;
24601
24602 return ethtool_ops->set_tx_csum(dev, edata.data);
24603 }
24604
ethtool_get_sg(struct net_device * dev,char * useraddr)24605 static int ethtool_get_sg(struct net_device *dev, char *useraddr)
24606 {
24607 struct ethtool_value edata = { ETHTOOL_GSG };
24608
24609 if (!ethtool_ops->get_sg)
24610 return -EOPNOTSUPP;
24611
24612 edata.data = ethtool_ops->get_sg(dev);
24613
24614 if (copy_to_user(useraddr, &edata, sizeof(edata)))
24615 return -EFAULT;
24616 return 0;
24617 }
24618
ethtool_set_sg(struct net_device * dev,char * useraddr)24619 static int ethtool_set_sg(struct net_device *dev, char *useraddr)
24620 {
24621 struct ethtool_value edata;
24622
24623 if (!ethtool_ops->set_sg)
24624 return -EOPNOTSUPP;
24625
24626 if (copy_from_user(&edata, useraddr, sizeof(edata)))
24627 return -EFAULT;
24628
24629 return ethtool_ops->set_sg(dev, edata.data);
24630 }
24631
ethtool_get_tso(struct net_device * dev,char * useraddr)24632 static int ethtool_get_tso(struct net_device *dev, char *useraddr)
24633 {
24634 struct ethtool_value edata = { ETHTOOL_GTSO };
24635
24636 if (!ethtool_ops->get_tso)
24637 return -EOPNOTSUPP;
24638
24639 edata.data = ethtool_ops->get_tso(dev);
24640
24641 if (copy_to_user(useraddr, &edata, sizeof(edata)))
24642 return -EFAULT;
24643 return 0;
24644 }
24645
ethtool_set_tso(struct net_device * dev,char * useraddr)24646 static int ethtool_set_tso(struct net_device *dev, char *useraddr)
24647 {
24648 struct ethtool_value edata;
24649
24650 if (!ethtool_ops->set_tso)
24651 return -EOPNOTSUPP;
24652
24653 if (copy_from_user(&edata, useraddr, sizeof(edata)))
24654 return -EFAULT;
24655
24656 return ethtool_ops->set_tso(dev, edata.data);
24657 }
24658
ethtool_self_test(struct net_device * dev,char * useraddr)24659 static int ethtool_self_test(struct net_device *dev, char *useraddr)
24660 {
24661 struct ethtool_test test;
24662 struct ethtool_ops *ops = ethtool_ops;
24663 u64 *data;
24664 int ret;
24665
24666 if (!ops->self_test || !ops->self_test_count)
24667 return -EOPNOTSUPP;
24668
24669 if (copy_from_user(&test, useraddr, sizeof(test)))
24670 return -EFAULT;
24671
24672 test.len = ops->self_test_count(dev);
24673 data = kmalloc(test.len * sizeof(u64), GFP_USER);
24674 if (!data)
24675 return -ENOMEM;
24676
24677 ops->self_test(dev, &test, data);
24678
24679 ret = -EFAULT;
24680 if (copy_to_user(useraddr, &test, sizeof(test)))
24681 goto out;
24682 useraddr += sizeof(test);
24683 if (copy_to_user(useraddr, data, test.len * sizeof(u64)))
24684 goto out;
24685 ret = 0;
24686
24687 out:
24688 kfree(data);
24689 return ret;
24690 }
24691
ethtool_get_strings(struct net_device * dev,void * useraddr)24692 static int ethtool_get_strings(struct net_device *dev, void *useraddr)
24693 {
24694 struct ethtool_gstrings gstrings;
24695 struct ethtool_ops *ops = ethtool_ops;
24696 u8 *data;
24697 int ret;
24698
24699 if (!ops->get_strings)
24700 return -EOPNOTSUPP;
24701
24702 if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
24703 return -EFAULT;
24704
24705 switch (gstrings.string_set) {
24706 case ETH_SS_TEST:
24707 if (!ops->self_test_count)
24708 return -EOPNOTSUPP;
24709 gstrings.len = ops->self_test_count(dev);
24710 break;
24711 case ETH_SS_STATS:
24712 if (!ops->get_stats_count)
24713 return -EOPNOTSUPP;
24714 gstrings.len = ops->get_stats_count(dev);
24715 break;
24716 default:
24717 return -EINVAL;
24718 }
24719
24720 data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
24721 if (!data)
24722 return -ENOMEM;
24723
24724 ops->get_strings(dev, gstrings.string_set, data);
24725
24726 ret = -EFAULT;
24727 if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
24728 goto out;
24729 useraddr += sizeof(gstrings);
24730 if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
24731 goto out;
24732 ret = 0;
24733
24734 out:
24735 kfree(data);
24736 return ret;
24737 }
24738
ethtool_phys_id(struct net_device * dev,void * useraddr)24739 static int ethtool_phys_id(struct net_device *dev, void *useraddr)
24740 {
24741 struct ethtool_value id;
24742
24743 if (!ethtool_ops->phys_id)
24744 return -EOPNOTSUPP;
24745
24746 if (copy_from_user(&id, useraddr, sizeof(id)))
24747 return -EFAULT;
24748
24749 return ethtool_ops->phys_id(dev, id.data);
24750 }
24751
ethtool_get_stats(struct net_device * dev,void * useraddr)24752 static int ethtool_get_stats(struct net_device *dev, void *useraddr)
24753 {
24754 struct ethtool_stats stats;
24755 struct ethtool_ops *ops = ethtool_ops;
24756 u64 *data;
24757 int ret;
24758
24759 if (!ops->get_ethtool_stats || !ops->get_stats_count)
24760 return -EOPNOTSUPP;
24761
24762 if (copy_from_user(&stats, useraddr, sizeof(stats)))
24763 return -EFAULT;
24764
24765 stats.n_stats = ops->get_stats_count(dev);
24766 data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER);
24767 if (!data)
24768 return -ENOMEM;
24769
24770 ops->get_ethtool_stats(dev, &stats, data);
24771
24772 ret = -EFAULT;
24773 if (copy_to_user(useraddr, &stats, sizeof(stats)))
24774 goto out;
24775 useraddr += sizeof(stats);
24776 if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64)))
24777 goto out;
24778 ret = 0;
24779
24780 out:
24781 kfree(data);
24782 return ret;
24783 }
24784
ethtool_ioctl(struct ifreq * ifr)24785 static int ethtool_ioctl(struct ifreq *ifr)
24786 {
24787 struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
24788 void *useraddr = (void *) ifr->ifr_data;
24789 u32 ethcmd;
24790
24791 /*
24792 * XXX: This can be pushed down into the ethtool_* handlers that
24793 * need it. Keep existing behaviour for the moment.
24794 */
24795 if (!capable(CAP_NET_ADMIN))
24796 return -EPERM;
24797
24798 if (!dev || !netif_device_present(dev))
24799 return -ENODEV;
24800
24801 if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd)))
24802 return -EFAULT;
24803
24804 switch (ethcmd) {
24805 case ETHTOOL_GSET:
24806 return ethtool_get_settings(dev, useraddr);
24807 case ETHTOOL_SSET:
24808 return ethtool_set_settings(dev, useraddr);
24809 case ETHTOOL_GDRVINFO:
24810 return ethtool_get_drvinfo(dev, useraddr);
24811 case ETHTOOL_GREGS:
24812 return ethtool_get_regs(dev, useraddr);
24813 case ETHTOOL_GWOL:
24814 return ethtool_get_wol(dev, useraddr);
24815 case ETHTOOL_SWOL:
24816 return ethtool_set_wol(dev, useraddr);
24817 case ETHTOOL_GMSGLVL:
24818 return ethtool_get_msglevel(dev, useraddr);
24819 case ETHTOOL_SMSGLVL:
24820 return ethtool_set_msglevel(dev, useraddr);
24821 case ETHTOOL_NWAY_RST:
24822 return ethtool_nway_reset(dev);
24823 case ETHTOOL_GLINK:
24824 return ethtool_get_link(dev, useraddr);
24825 case ETHTOOL_GEEPROM:
24826 return ethtool_get_eeprom(dev, useraddr);
24827 case ETHTOOL_SEEPROM:
24828 return ethtool_set_eeprom(dev, useraddr);
24829 case ETHTOOL_GCOALESCE:
24830 return ethtool_get_coalesce(dev, useraddr);
24831 case ETHTOOL_SCOALESCE:
24832 return ethtool_set_coalesce(dev, useraddr);
24833 case ETHTOOL_GRINGPARAM:
24834 return ethtool_get_ringparam(dev, useraddr);
24835 case ETHTOOL_SRINGPARAM:
24836 return ethtool_set_ringparam(dev, useraddr);
24837 case ETHTOOL_GPAUSEPARAM:
24838 return ethtool_get_pauseparam(dev, useraddr);
24839 case ETHTOOL_SPAUSEPARAM:
24840 return ethtool_set_pauseparam(dev, useraddr);
24841 case ETHTOOL_GRXCSUM:
24842 return ethtool_get_rx_csum(dev, useraddr);
24843 case ETHTOOL_SRXCSUM:
24844 return ethtool_set_rx_csum(dev, useraddr);
24845 case ETHTOOL_GTXCSUM:
24846 return ethtool_get_tx_csum(dev, useraddr);
24847 case ETHTOOL_STXCSUM:
24848 return ethtool_set_tx_csum(dev, useraddr);
24849 case ETHTOOL_GSG:
24850 return ethtool_get_sg(dev, useraddr);
24851 case ETHTOOL_SSG:
24852 return ethtool_set_sg(dev, useraddr);
24853 case ETHTOOL_GTSO:
24854 return ethtool_get_tso(dev, useraddr);
24855 case ETHTOOL_STSO:
24856 return ethtool_set_tso(dev, useraddr);
24857 case ETHTOOL_TEST:
24858 return ethtool_self_test(dev, useraddr);
24859 case ETHTOOL_GSTRINGS:
24860 return ethtool_get_strings(dev, useraddr);
24861 case ETHTOOL_PHYS_ID:
24862 return ethtool_phys_id(dev, useraddr);
24863 case ETHTOOL_GSTATS:
24864 return ethtool_get_stats(dev, useraddr);
24865 default:
24866 return -EOPNOTSUPP;
24867 }
24868
24869 return -EOPNOTSUPP;
24870 }
24871 #endif //ETHTOOL_OPS_COMPAT
24872
24873 static int
rtl8168_do_ioctl(struct net_device * dev,struct ifreq * ifr,int cmd)24874 rtl8168_do_ioctl(struct net_device *dev,
24875 struct ifreq *ifr,
24876 int cmd)
24877 {
24878 struct rtl8168_private *tp = netdev_priv(dev);
24879 struct mii_ioctl_data *data = if_mii(ifr);
24880 int ret;
24881 unsigned long flags;
24882
24883 ret = 0;
24884 switch (cmd) {
24885 case SIOCGMIIPHY:
24886 data->phy_id = 32; /* Internal PHY */
24887 break;
24888
24889 case SIOCGMIIREG:
24890 spin_lock_irqsave(&tp->lock, flags);
24891 rtl8168_mdio_write(tp, 0x1F, 0x0000);
24892 data->val_out = rtl8168_mdio_read(tp, data->reg_num);
24893 spin_unlock_irqrestore(&tp->lock, flags);
24894 break;
24895
24896 case SIOCSMIIREG:
24897 if (!capable(CAP_NET_ADMIN))
24898 return -EPERM;
24899 spin_lock_irqsave(&tp->lock, flags);
24900 rtl8168_mdio_write(tp, 0x1F, 0x0000);
24901 rtl8168_mdio_write(tp, data->reg_num, data->val_in);
24902 spin_unlock_irqrestore(&tp->lock, flags);
24903 break;
24904
24905 #ifdef ETHTOOL_OPS_COMPAT
24906 case SIOCETHTOOL:
24907 ret = ethtool_ioctl(ifr);
24908 break;
24909 #endif
24910 case SIOCDEVPRIVATE_RTLASF:
24911 if (!netif_running(dev)) {
24912 ret = -ENODEV;
24913 break;
24914 }
24915
24916 ret = rtl8168_asf_ioctl(dev, ifr);
24917 break;
24918
24919 #ifdef ENABLE_DASH_SUPPORT
24920 case SIOCDEVPRIVATE_RTLDASH:
24921 if (!netif_running(dev)) {
24922 ret = -ENODEV;
24923 break;
24924 }
24925 if (!capable(CAP_NET_ADMIN)) {
24926 ret = -EPERM;
24927 break;
24928 }
24929
24930 ret = rtl8168_dash_ioctl(dev, ifr);
24931 break;
24932 #endif
24933
24934 #ifdef ENABLE_REALWOW_SUPPORT
24935 case SIOCDEVPRIVATE_RTLREALWOW:
24936 if (!netif_running(dev)) {
24937 ret = -ENODEV;
24938 break;
24939 }
24940
24941 ret = rtl8168_realwow_ioctl(dev, ifr);
24942 break;
24943 #endif
24944
24945 case SIOCRTLTOOL:
24946 ret = rtl8168_tool_ioctl(tp, ifr);
24947 break;
24948
24949 default:
24950 ret = -EOPNOTSUPP;
24951 break;
24952 }
24953
24954 return ret;
24955 }
24956
24957 static void
rtl8168_phy_power_up(struct net_device * dev)24958 rtl8168_phy_power_up(struct net_device *dev)
24959 {
24960 struct rtl8168_private *tp = netdev_priv(dev);
24961
24962 if (rtl8168_is_in_phy_disable_mode(dev))
24963 return;
24964
24965 rtl8168_mdio_write(tp, 0x1F, 0x0000);
24966 switch (tp->mcfg) {
24967 case CFG_METHOD_1:
24968 case CFG_METHOD_2:
24969 case CFG_METHOD_3:
24970 case CFG_METHOD_4:
24971 case CFG_METHOD_5:
24972 case CFG_METHOD_6:
24973 case CFG_METHOD_7:
24974 case CFG_METHOD_8:
24975 case CFG_METHOD_9:
24976 case CFG_METHOD_10:
24977 case CFG_METHOD_11:
24978 case CFG_METHOD_12:
24979 case CFG_METHOD_13:
24980 rtl8168_mdio_write(tp, 0x0E, 0x0000);
24981 break;
24982 }
24983 rtl8168_mdio_write(tp, MII_BMCR, BMCR_ANENABLE);
24984
24985 //wait mdc/mdio ready
24986 switch (tp->mcfg) {
24987 case CFG_METHOD_23:
24988 case CFG_METHOD_27:
24989 case CFG_METHOD_28:
24990 mdelay(10);
24991 break;
24992 }
24993
24994 //wait ups resume (phy state 3)
24995 if (HW_SUPPORT_UPS_MODE(tp))
24996 rtl8168_wait_phy_ups_resume(dev, HW_PHY_STATUS_LAN_ON);
24997 }
24998
24999 static void
rtl8168_phy_power_down(struct net_device * dev)25000 rtl8168_phy_power_down(struct net_device *dev)
25001 {
25002 struct rtl8168_private *tp = netdev_priv(dev);
25003 u32 csi_tmp;
25004
25005 switch (tp->mcfg) {
25006 case CFG_METHOD_21:
25007 case CFG_METHOD_22:
25008 case CFG_METHOD_23:
25009 case CFG_METHOD_24:
25010 csi_tmp = rtl8168_eri_read(tp, 0x1AB, 1, ERIAR_ExGMAC);
25011 csi_tmp &= ~( BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7 );
25012 rtl8168_eri_write(tp, 0x1AB, 1, csi_tmp, ERIAR_ExGMAC);
25013 break;
25014 }
25015
25016 rtl8168_mdio_write(tp, 0x1F, 0x0000);
25017 switch (tp->mcfg) {
25018 case CFG_METHOD_1:
25019 case CFG_METHOD_2:
25020 case CFG_METHOD_3:
25021 case CFG_METHOD_4:
25022 case CFG_METHOD_5:
25023 case CFG_METHOD_6:
25024 case CFG_METHOD_7:
25025 case CFG_METHOD_8:
25026 case CFG_METHOD_9:
25027 case CFG_METHOD_10:
25028 case CFG_METHOD_11:
25029 case CFG_METHOD_12:
25030 case CFG_METHOD_13:
25031 rtl8168_mdio_write(tp, 0x0E, 0x0200);
25032 rtl8168_mdio_write(tp, MII_BMCR, BMCR_PDOWN);
25033 break;
25034 case CFG_METHOD_14:
25035 case CFG_METHOD_15:
25036 case CFG_METHOD_29:
25037 case CFG_METHOD_30:
25038 rtl8168_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN);
25039 break;
25040 case CFG_METHOD_21:
25041 case CFG_METHOD_22:
25042 rtl8168_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN);
25043 break;
25044 case CFG_METHOD_23:
25045 case CFG_METHOD_24:
25046 rtl8168_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN);
25047 break;
25048 default:
25049 rtl8168_mdio_write(tp, MII_BMCR, BMCR_PDOWN);
25050 break;
25051 }
25052 }
25053
25054 static int __devinit
rtl8168_init_board(struct pci_dev * pdev,struct net_device ** dev_out,void __iomem ** ioaddr_out)25055 rtl8168_init_board(struct pci_dev *pdev,
25056 struct net_device **dev_out,
25057 void __iomem **ioaddr_out)
25058 {
25059 void __iomem *ioaddr;
25060 struct net_device *dev;
25061 struct rtl8168_private *tp;
25062 int rc = -ENOMEM, i, pm_cap;
25063
25064 assert(ioaddr_out != NULL);
25065
25066 /* dev zeroed in alloc_etherdev */
25067 dev = alloc_etherdev(sizeof (*tp));
25068 if (dev == NULL) {
25069 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25070 if (netif_msg_drv(&debug))
25071 dev_err(&pdev->dev, "unable to alloc new ethernet\n");
25072 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25073 goto err_out;
25074 }
25075
25076 SET_MODULE_OWNER(dev);
25077 SET_NETDEV_DEV(dev, &pdev->dev);
25078 tp = netdev_priv(dev);
25079 tp->dev = dev;
25080 tp->msg_enable = netif_msg_init(debug.msg_enable, R8168_MSG_DEFAULT);
25081
25082 if (!aspm || tp->mcfg == CFG_METHOD_9) {
25083 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
25084 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
25085 PCIE_LINK_STATE_CLKPM);
25086 #endif
25087 }
25088
25089 /* enable device (incl. PCI PM wakeup and hotplug setup) */
25090 rc = pci_enable_device(pdev);
25091 if (rc < 0) {
25092 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25093 if (netif_msg_probe(tp))
25094 dev_err(&pdev->dev, "enable failure\n");
25095 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25096 goto err_out_free_dev;
25097 }
25098
25099 if (pci_set_mwi(pdev) < 0) {
25100 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25101 if (netif_msg_drv(&debug))
25102 dev_info(&pdev->dev, "Mem-Wr-Inval unavailable.\n");
25103 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25104 }
25105
25106 /* save power state before pci_enable_device overwrites it */
25107 pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
25108 if (pm_cap) {
25109 u16 pwr_command;
25110
25111 pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command);
25112 } else {
25113 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25114 if (netif_msg_probe(tp)) {
25115 dev_err(&pdev->dev, "PowerManagement capability not found.\n");
25116 }
25117 #else
25118 printk("PowerManagement capability not found.\n");
25119 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25120
25121 }
25122
25123 /* make sure PCI base addr 1 is MMIO */
25124 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
25125 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25126 if (netif_msg_probe(tp))
25127 dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
25128 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25129 rc = -ENODEV;
25130 goto err_out_mwi;
25131 }
25132 /* check for weird/broken PCI region reporting */
25133 if (pci_resource_len(pdev, 2) < R8168_REGS_SIZE) {
25134 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25135 if (netif_msg_probe(tp))
25136 dev_err(&pdev->dev, "Invalid PCI region size(s), aborting\n");
25137 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25138 rc = -ENODEV;
25139 goto err_out_mwi;
25140 }
25141
25142 rc = pci_request_regions(pdev, MODULENAME);
25143 if (rc < 0) {
25144 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25145 if (netif_msg_probe(tp))
25146 dev_err(&pdev->dev, "could not request regions.\n");
25147 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25148 goto err_out_mwi;
25149 }
25150
25151 if ((sizeof(dma_addr_t) > 4) &&
25152 use_dac &&
25153 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
25154 !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
25155 dev->features |= NETIF_F_HIGHDMA;
25156 } else {
25157 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
25158 if (rc < 0) {
25159 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25160 if (netif_msg_probe(tp))
25161 dev_err(&pdev->dev, "DMA configuration failed.\n");
25162 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25163 goto err_out_free_res;
25164 }
25165 }
25166
25167 /* ioremap MMIO region */
25168 ioaddr = ioremap(pci_resource_start(pdev, 2), R8168_REGS_SIZE);
25169 if (ioaddr == NULL) {
25170 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25171 if (netif_msg_probe(tp))
25172 dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
25173 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25174 rc = -EIO;
25175 goto err_out_free_res;
25176 }
25177
25178 tp->mmio_addr = ioaddr;
25179
25180 /* Identify chip attached to board */
25181 rtl8168_get_mac_version(tp);
25182
25183 rtl8168_print_mac_version(tp);
25184
25185 for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) {
25186 if (tp->mcfg == rtl_chip_info[i].mcfg)
25187 break;
25188 }
25189
25190 if (i < 0) {
25191 /* Unknown chip: assume array element #0, original RTL-8168 */
25192 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25193 if (netif_msg_probe(tp))
25194 dev_printk(KERN_DEBUG, &pdev->dev, "unknown chip version, assuming %s\n", rtl_chip_info[0].name);
25195 #else
25196 printk("Realtek unknown chip version, assuming %s\n", rtl_chip_info[0].name);
25197 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
25198 i++;
25199 }
25200
25201 tp->chipset = i;
25202
25203 *ioaddr_out = ioaddr;
25204 *dev_out = dev;
25205 out:
25206 return rc;
25207
25208 err_out_free_res:
25209 pci_release_regions(pdev);
25210 err_out_mwi:
25211 pci_clear_mwi(pdev);
25212 pci_disable_device(pdev);
25213 err_out_free_dev:
25214 free_netdev(dev);
25215 err_out:
25216 *ioaddr_out = NULL;
25217 *dev_out = NULL;
25218 goto out;
25219 }
25220
25221 static void
25222 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
rtl8168_esd_timer(unsigned long __opaque)25223 rtl8168_esd_timer(unsigned long __opaque)
25224 #else
25225 rtl8168_esd_timer(struct timer_list *t)
25226 #endif
25227 {
25228 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
25229 struct net_device *dev = (struct net_device *)__opaque;
25230 struct rtl8168_private *tp = netdev_priv(dev);
25231 struct timer_list *timer = &tp->esd_timer;
25232 #else
25233 struct rtl8168_private *tp = from_timer(tp, t, esd_timer);
25234 struct net_device *dev = tp->dev;
25235 struct timer_list *timer = t;
25236 #endif
25237 struct pci_dev *pdev = tp->pci_dev;
25238 unsigned long timeout = RTL8168_ESD_TIMEOUT;
25239 unsigned long flags;
25240 u8 cmd;
25241 u16 io_base_l;
25242 u16 mem_base_l;
25243 u16 mem_base_h;
25244 u8 ilr;
25245 u16 resv_0x1c_h;
25246 u16 resv_0x1c_l;
25247 u16 resv_0x20_l;
25248 u16 resv_0x20_h;
25249 u16 resv_0x24_l;
25250 u16 resv_0x24_h;
25251 u16 resv_0x2c_h;
25252 u16 resv_0x2c_l;
25253 u32 pci_sn_l;
25254 u32 pci_sn_h;
25255
25256 spin_lock_irqsave(&tp->lock, flags);
25257
25258 tp->esd_flag = 0;
25259
25260 pci_read_config_byte(pdev, PCI_COMMAND, &cmd);
25261 if (cmd != tp->pci_cfg_space.cmd) {
25262 printk(KERN_ERR "%s: cmd = 0x%02x, should be 0x%02x \n.", dev->name, cmd, tp->pci_cfg_space.cmd);
25263 pci_write_config_byte(pdev, PCI_COMMAND, tp->pci_cfg_space.cmd);
25264 tp->esd_flag |= BIT_0;
25265 }
25266
25267 pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &io_base_l);
25268 if (io_base_l != tp->pci_cfg_space.io_base_l) {
25269 printk(KERN_ERR "%s: io_base_l = 0x%04x, should be 0x%04x \n.", dev->name, io_base_l, tp->pci_cfg_space.io_base_l);
25270 pci_write_config_word(pdev, PCI_BASE_ADDRESS_0, tp->pci_cfg_space.io_base_l);
25271 tp->esd_flag |= BIT_1;
25272 }
25273
25274 pci_read_config_word(pdev, PCI_BASE_ADDRESS_2, &mem_base_l);
25275 if (mem_base_l != tp->pci_cfg_space.mem_base_l) {
25276 printk(KERN_ERR "%s: mem_base_l = 0x%04x, should be 0x%04x \n.", dev->name, mem_base_l, tp->pci_cfg_space.mem_base_l);
25277 pci_write_config_word(pdev, PCI_BASE_ADDRESS_2, tp->pci_cfg_space.mem_base_l);
25278 tp->esd_flag |= BIT_2;
25279 }
25280
25281 pci_read_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, &mem_base_h);
25282 if (mem_base_h!= tp->pci_cfg_space.mem_base_h) {
25283 printk(KERN_ERR "%s: mem_base_h = 0x%04x, should be 0x%04x \n.", dev->name, mem_base_h, tp->pci_cfg_space.mem_base_h);
25284 pci_write_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, tp->pci_cfg_space.mem_base_h);
25285 tp->esd_flag |= BIT_3;
25286 }
25287
25288 pci_read_config_word(pdev, PCI_BASE_ADDRESS_3, &resv_0x1c_l);
25289 if (resv_0x1c_l != tp->pci_cfg_space.resv_0x1c_l) {
25290 printk(KERN_ERR "%s: resv_0x1c_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x1c_l, tp->pci_cfg_space.resv_0x1c_l);
25291 pci_write_config_word(pdev, PCI_BASE_ADDRESS_3, tp->pci_cfg_space.resv_0x1c_l);
25292 tp->esd_flag |= BIT_4;
25293 }
25294
25295 pci_read_config_word(pdev, PCI_BASE_ADDRESS_3 + 2, &resv_0x1c_h);
25296 if (resv_0x1c_h != tp->pci_cfg_space.resv_0x1c_h) {
25297 printk(KERN_ERR "%s: resv_0x1c_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x1c_h, tp->pci_cfg_space.resv_0x1c_h);
25298 pci_write_config_word(pdev, PCI_BASE_ADDRESS_3 + 2, tp->pci_cfg_space.resv_0x1c_h);
25299 tp->esd_flag |= BIT_5;
25300 }
25301
25302 pci_read_config_word(pdev, PCI_BASE_ADDRESS_4, &resv_0x20_l);
25303 if (resv_0x20_l != tp->pci_cfg_space.resv_0x20_l) {
25304 printk(KERN_ERR "%s: resv_0x20_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x20_l, tp->pci_cfg_space.resv_0x20_l);
25305 pci_write_config_word(pdev, PCI_BASE_ADDRESS_4, tp->pci_cfg_space.resv_0x20_l);
25306 tp->esd_flag |= BIT_6;
25307 }
25308
25309 pci_read_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, &resv_0x20_h);
25310 if (resv_0x20_h != tp->pci_cfg_space.resv_0x20_h) {
25311 printk(KERN_ERR "%s: resv_0x20_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x20_h, tp->pci_cfg_space.resv_0x20_h);
25312 pci_write_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, tp->pci_cfg_space.resv_0x20_h);
25313 tp->esd_flag |= BIT_7;
25314 }
25315
25316 pci_read_config_word(pdev, PCI_BASE_ADDRESS_5, &resv_0x24_l);
25317 if (resv_0x24_l != tp->pci_cfg_space.resv_0x24_l) {
25318 printk(KERN_ERR "%s: resv_0x24_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x24_l, tp->pci_cfg_space.resv_0x24_l);
25319 pci_write_config_word(pdev, PCI_BASE_ADDRESS_5, tp->pci_cfg_space.resv_0x24_l);
25320 tp->esd_flag |= BIT_8;
25321 }
25322
25323 pci_read_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, &resv_0x24_h);
25324 if (resv_0x24_h != tp->pci_cfg_space.resv_0x24_h) {
25325 printk(KERN_ERR "%s: resv_0x24_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x24_h, tp->pci_cfg_space.resv_0x24_h);
25326 pci_write_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, tp->pci_cfg_space.resv_0x24_h);
25327 tp->esd_flag |= BIT_9;
25328 }
25329
25330 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ilr);
25331 if (ilr != tp->pci_cfg_space.ilr) {
25332 printk(KERN_ERR "%s: ilr = 0x%02x, should be 0x%02x \n.", dev->name, ilr, tp->pci_cfg_space.ilr);
25333 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, tp->pci_cfg_space.ilr);
25334 tp->esd_flag |= BIT_10;
25335 }
25336
25337 pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &resv_0x2c_l);
25338 if (resv_0x2c_l != tp->pci_cfg_space.resv_0x2c_l) {
25339 printk(KERN_ERR "%s: resv_0x2c_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x2c_l, tp->pci_cfg_space.resv_0x2c_l);
25340 pci_write_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, tp->pci_cfg_space.resv_0x2c_l);
25341 tp->esd_flag |= BIT_11;
25342 }
25343
25344 pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, &resv_0x2c_h);
25345 if (resv_0x2c_h != tp->pci_cfg_space.resv_0x2c_h) {
25346 printk(KERN_ERR "%s: resv_0x2c_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x2c_h, tp->pci_cfg_space.resv_0x2c_h);
25347 pci_write_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, tp->pci_cfg_space.resv_0x2c_h);
25348 tp->esd_flag |= BIT_12;
25349 }
25350
25351 if (tp->HwPcieSNOffset > 0) {
25352 pci_sn_l = rtl8168_csi_read(tp, tp->HwPcieSNOffset);
25353 if (pci_sn_l != tp->pci_cfg_space.pci_sn_l) {
25354 printk(KERN_ERR "%s: pci_sn_l = 0x%08x, should be 0x%08x \n.", dev->name, pci_sn_l, tp->pci_cfg_space.pci_sn_l);
25355 rtl8168_csi_write(tp, tp->HwPcieSNOffset, tp->pci_cfg_space.pci_sn_l);
25356 tp->esd_flag |= BIT_13;
25357 }
25358
25359 pci_sn_h = rtl8168_csi_read(tp, tp->HwPcieSNOffset + 4);
25360 if (pci_sn_h != tp->pci_cfg_space.pci_sn_h) {
25361 printk(KERN_ERR "%s: pci_sn_h = 0x%08x, should be 0x%08x \n.", dev->name, pci_sn_h, tp->pci_cfg_space.pci_sn_h);
25362 rtl8168_csi_write(tp, tp->HwPcieSNOffset + 4, tp->pci_cfg_space.pci_sn_h);
25363 tp->esd_flag |= BIT_14;
25364 }
25365 }
25366
25367 if (tp->TestPhyOcpReg && rtl8168_test_phy_ocp(tp))
25368 tp->esd_flag |= BIT_15;
25369
25370 if (tp->esd_flag != 0) {
25371 printk(KERN_ERR "%s: esd_flag = 0x%04x\n.\n", dev->name, tp->esd_flag);
25372 netif_stop_queue(dev);
25373 netif_carrier_off(dev);
25374 rtl8168_hw_reset(dev);
25375 rtl8168_tx_clear(tp);
25376 rtl8168_rx_clear(tp);
25377 rtl8168_init_ring(dev);
25378 rtl8168_hw_init(dev);
25379 rtl8168_powerup_pll(dev);
25380 rtl8168_hw_ephy_config(dev);
25381 rtl8168_hw_phy_config(dev);
25382 rtl8168_hw_config(dev);
25383 rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
25384 tp->esd_flag = 0;
25385 }
25386 spin_unlock_irqrestore(&tp->lock, flags);
25387
25388 mod_timer(timer, jiffies + timeout);
25389 }
25390
25391 static void
25392 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
rtl8168_link_timer(unsigned long __opaque)25393 rtl8168_link_timer(unsigned long __opaque)
25394 #else
25395 rtl8168_link_timer(struct timer_list *t)
25396 #endif
25397 {
25398 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
25399 struct net_device *dev = (struct net_device *)__opaque;
25400 struct rtl8168_private *tp = netdev_priv(dev);
25401 struct timer_list *timer = &tp->link_timer;
25402 #else
25403 struct rtl8168_private *tp = from_timer(tp, t, link_timer);
25404 struct net_device *dev = tp->dev;
25405 struct timer_list *timer = t;
25406 #endif
25407 unsigned long flags;
25408
25409 spin_lock_irqsave(&tp->lock, flags);
25410 rtl8168_check_link_status(dev);
25411 spin_unlock_irqrestore(&tp->lock, flags);
25412
25413 mod_timer(timer, jiffies + RTL8168_LINK_TIMEOUT);
25414 }
25415
25416 /* Cfg9346_Unlock assumed. */
rtl8168_try_msi(struct pci_dev * pdev,struct rtl8168_private * tp)25417 static unsigned rtl8168_try_msi(struct pci_dev *pdev, struct rtl8168_private *tp)
25418 {
25419 unsigned msi = 0;
25420
25421 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
25422 switch (tp->mcfg) {
25423 case CFG_METHOD_1:
25424 case CFG_METHOD_2:
25425 case CFG_METHOD_3:
25426 case CFG_METHOD_4:
25427 case CFG_METHOD_5:
25428 case CFG_METHOD_6:
25429 case CFG_METHOD_7:
25430 case CFG_METHOD_8:
25431 dev_info(&pdev->dev, "Default use INTx.\n");
25432 break;
25433 default:
25434 if (pci_enable_msi(pdev))
25435 dev_info(&pdev->dev, "no MSI. Back to INTx.\n");
25436 else
25437 msi |= RTL_FEATURE_MSI;
25438 break;
25439 }
25440 #endif
25441
25442 return msi;
25443 }
25444
rtl8168_disable_msi(struct pci_dev * pdev,struct rtl8168_private * tp)25445 static void rtl8168_disable_msi(struct pci_dev *pdev, struct rtl8168_private *tp)
25446 {
25447 if (tp->features & RTL_FEATURE_MSI) {
25448 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
25449 pci_disable_msi(pdev);
25450 #endif
25451 tp->features &= ~RTL_FEATURE_MSI;
25452 }
25453 }
25454
25455 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
25456 static const struct net_device_ops rtl8168_netdev_ops = {
25457 .ndo_open = rtl8168_open,
25458 .ndo_stop = rtl8168_close,
25459 .ndo_get_stats = rtl8168_get_stats,
25460 .ndo_start_xmit = rtl8168_start_xmit,
25461 .ndo_tx_timeout = rtl8168_tx_timeout,
25462 .ndo_change_mtu = rtl8168_change_mtu,
25463 .ndo_set_mac_address = rtl8168_set_mac_address,
25464 .ndo_do_ioctl = rtl8168_do_ioctl,
25465 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
25466 .ndo_set_multicast_list = rtl8168_set_rx_mode,
25467 #else
25468 .ndo_set_rx_mode = rtl8168_set_rx_mode,
25469 #endif
25470 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
25471 #ifdef CONFIG_R8168_VLAN
25472 .ndo_vlan_rx_register = rtl8168_vlan_rx_register,
25473 #endif
25474 #else
25475 .ndo_fix_features = rtl8168_fix_features,
25476 .ndo_set_features = rtl8168_set_features,
25477 #endif
25478 #ifdef CONFIG_NET_POLL_CONTROLLER
25479 .ndo_poll_controller = rtl8168_netpoll,
25480 #endif
25481 };
25482 #endif
25483
25484 static int __devinit
rtl8168_init_one(struct pci_dev * pdev,const struct pci_device_id * ent)25485 rtl8168_init_one(struct pci_dev *pdev,
25486 const struct pci_device_id *ent)
25487 {
25488 struct net_device *dev = NULL;
25489 struct rtl8168_private *tp;
25490 void __iomem *ioaddr = NULL;
25491 static int board_idx = -1;
25492
25493 int rc;
25494
25495 assert(pdev != NULL);
25496 assert(ent != NULL);
25497
25498 board_idx++;
25499
25500 if (netif_msg_drv(&debug))
25501 printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
25502 MODULENAME, RTL8168_VERSION);
25503
25504 rc = rtl8168_init_board(pdev, &dev, &ioaddr);
25505 if (rc)
25506 goto out;
25507
25508 tp = netdev_priv(dev);
25509 assert(ioaddr != NULL);
25510
25511 tp->set_speed = rtl8168_set_speed_xmii;
25512 tp->get_settings = rtl8168_gset_xmii;
25513 tp->phy_reset_enable = rtl8168_xmii_reset_enable;
25514 tp->phy_reset_pending = rtl8168_xmii_reset_pending;
25515 tp->link_ok = rtl8168_xmii_link_ok;
25516
25517 tp->features |= rtl8168_try_msi(pdev, tp);
25518
25519 RTL_NET_DEVICE_OPS(rtl8168_netdev_ops);
25520
25521 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
25522 SET_ETHTOOL_OPS(dev, &rtl8168_ethtool_ops);
25523 #endif
25524
25525 dev->watchdog_timeo = RTL8168_TX_TIMEOUT;
25526 dev->irq = pdev->irq;
25527 dev->base_addr = (unsigned long) ioaddr;
25528
25529 #ifdef CONFIG_R8168_NAPI
25530 RTL_NAPI_CONFIG(dev, tp, rtl8168_poll, R8168_NAPI_WEIGHT);
25531 #endif
25532
25533 #ifdef CONFIG_R8168_VLAN
25534 if (tp->mcfg != CFG_METHOD_DEFAULT) {
25535 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
25536 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
25537 dev->vlan_rx_kill_vid = rtl8168_vlan_rx_kill_vid;
25538 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
25539 }
25540 #endif
25541
25542 /* There has been a number of reports that using SG/TSO results in
25543 * tx timeouts. However for a lot of people SG/TSO works fine.
25544 * Therefore disable both features by default, but allow users to
25545 * enable them. Use at own risk!
25546 */
25547 tp->cp_cmd |= RTL_R16(tp, CPlusCmd);
25548 if (tp->mcfg != CFG_METHOD_DEFAULT) {
25549 dev->features |= NETIF_F_IP_CSUM;
25550 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
25551 tp->cp_cmd |= RxChkSum;
25552 #else
25553 dev->features |= NETIF_F_RXCSUM;
25554 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
25555 NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
25556 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM |
25557 NETIF_F_HIGHDMA;
25558 if ((tp->mcfg != CFG_METHOD_16) && (tp->mcfg != CFG_METHOD_17)) {
25559 //dev->features |= NETIF_F_TSO;
25560 dev->hw_features |= NETIF_F_TSO;
25561 dev->vlan_features |= NETIF_F_TSO;
25562 }
25563 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
25564 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
25565 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
25566 dev->hw_features |= NETIF_F_RXALL;
25567 dev->hw_features |= NETIF_F_RXFCS;
25568 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
25569 if ((tp->mcfg == CFG_METHOD_1) || (tp->mcfg == CFG_METHOD_2) || (tp->mcfg == CFG_METHOD_3)) {
25570 dev->hw_features &= ~NETIF_F_IPV6_CSUM;
25571 netif_set_gso_max_size(dev, LSO_32K);
25572 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)
25573 dev->gso_max_segs = NIC_MAX_PHYS_BUF_COUNT_LSO_64K;
25574 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
25575 dev->gso_min_segs = NIC_MIN_PHYS_BUF_COUNT;
25576 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
25577 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)
25578 } else {
25579 dev->hw_features |= NETIF_F_IPV6_CSUM;
25580 dev->features |= NETIF_F_IPV6_CSUM;
25581 if ((tp->mcfg != CFG_METHOD_16) && (tp->mcfg != CFG_METHOD_17)) {
25582 dev->hw_features |= NETIF_F_TSO6;
25583 //dev->features |= NETIF_F_TSO6;
25584 }
25585 netif_set_gso_max_size(dev, LSO_64K);
25586 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)
25587 dev->gso_max_segs = NIC_MAX_PHYS_BUF_COUNT_LSO2;
25588 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
25589 dev->gso_min_segs = NIC_MIN_PHYS_BUF_COUNT;
25590 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
25591 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)
25592 }
25593 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
25594 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
25595 }
25596
25597 tp->pci_dev = pdev;
25598
25599 spin_lock_init(&tp->lock);
25600
25601 rtl8168_init_software_variable(dev);
25602
25603 #ifdef ENABLE_DASH_SUPPORT
25604 if (tp->DASH)
25605 AllocateDashShareMemory(dev);
25606 #endif
25607
25608 rtl8168_exit_oob(dev);
25609
25610 rtl8168_hw_init(dev);
25611
25612 rtl8168_hw_reset(dev);
25613
25614 /* Get production from EEPROM */
25615 if (((tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
25616 tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_29 ||
25617 tp->mcfg == CFG_METHOD_30) && (rtl8168_mac_ocp_read(tp, 0xDC00) & BIT_3)) ||
25618 ((tp->mcfg == CFG_METHOD_26) && (rtl8168_mac_ocp_read(tp, 0xDC00) & BIT_4)))
25619 tp->eeprom_type = EEPROM_TYPE_NONE;
25620 else
25621 rtl8168_eeprom_type(tp);
25622
25623 if (tp->eeprom_type == EEPROM_TYPE_93C46 || tp->eeprom_type == EEPROM_TYPE_93C56)
25624 rtl8168_set_eeprom_sel_low(tp);
25625
25626 rtl8168_get_mac_address(dev);
25627
25628 tp->fw_name = rtl_chip_fw_infos[tp->mcfg].fw_name;
25629
25630 #if defined(ENABLE_DASH_PRINTER_SUPPORT)
25631 init_completion(&tp->fw_host_ok);
25632 init_completion(&tp->fw_ack);
25633 init_completion(&tp->fw_req);
25634 #endif
25635
25636 tp->tally_vaddr = dma_alloc_coherent(&pdev->dev, sizeof(*tp->tally_vaddr),
25637 &tp->tally_paddr, GFP_KERNEL);
25638 if (!tp->tally_vaddr) {
25639 rc = -ENOMEM;
25640 goto err_out;
25641 }
25642
25643 rtl8168_tally_counter_clear(tp);
25644
25645 pci_set_drvdata(pdev, dev);
25646
25647 rc = register_netdev(dev);
25648 if (rc)
25649 goto err_out;
25650
25651 printk(KERN_INFO "%s: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.\n", MODULENAME);
25652
25653 rtl8168_disable_rxdvgate(dev);
25654
25655 device_set_wakeup_enable(&pdev->dev, tp->wol_enabled);
25656
25657 netif_carrier_off(dev);
25658
25659 printk("%s", GPL_CLAIM);
25660
25661 out:
25662 return rc;
25663
25664 err_out:
25665 if (tp->tally_vaddr != NULL) {
25666 dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr,
25667 tp->tally_paddr);
25668
25669 tp->tally_vaddr = NULL;
25670 }
25671 #ifdef CONFIG_R8168_NAPI
25672 RTL_NAPI_DEL(tp);
25673 #endif
25674 rtl8168_disable_msi(pdev, tp);
25675 rtl8168_release_board(pdev, dev);
25676
25677 goto out;
25678 }
25679
25680 static void __devexit
rtl8168_remove_one(struct pci_dev * pdev)25681 rtl8168_remove_one(struct pci_dev *pdev)
25682 {
25683 struct net_device *dev = pci_get_drvdata(pdev);
25684 struct rtl8168_private *tp = netdev_priv(dev);
25685
25686 assert(dev != NULL);
25687 assert(tp != NULL);
25688
25689 #ifdef CONFIG_R8168_NAPI
25690 RTL_NAPI_DEL(tp);
25691 #endif
25692 if (HW_DASH_SUPPORT_DASH(tp))
25693 rtl8168_driver_stop(tp);
25694
25695 unregister_netdev(dev);
25696 rtl8168_disable_msi(pdev, tp);
25697 #ifdef ENABLE_R8168_PROCFS
25698 rtl8168_proc_remove(dev);
25699 #endif
25700 if (tp->tally_vaddr != NULL) {
25701 dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr, tp->tally_paddr);
25702 tp->tally_vaddr = NULL;
25703 }
25704
25705 rtl8168_release_board(pdev, dev);
25706
25707 #ifdef ENABLE_USE_FIRMWARE_FILE
25708 rtl8168_release_firmware(tp);
25709 #endif
25710
25711 pci_set_drvdata(pdev, NULL);
25712 }
25713
25714 static void
rtl8168_set_rxbufsize(struct rtl8168_private * tp,struct net_device * dev)25715 rtl8168_set_rxbufsize(struct rtl8168_private *tp,
25716 struct net_device *dev)
25717 {
25718 unsigned int mtu = dev->mtu;
25719
25720 tp->rx_buf_sz = (mtu > ETH_DATA_LEN) ? mtu + ETH_HLEN + 8 + 1 : RX_BUF_SIZE;
25721 }
25722
25723 #ifdef ENABLE_USE_FIRMWARE_FILE
rtl8168_request_firmware(struct rtl8168_private * tp)25724 static void rtl8168_request_firmware(struct rtl8168_private *tp)
25725 {
25726 struct rtl8168_fw *rtl_fw;
25727
25728 /* firmware loaded already or no firmware available */
25729 if (tp->rtl_fw || !tp->fw_name)
25730 return;
25731
25732 rtl_fw = kzalloc(sizeof(*rtl_fw), GFP_KERNEL);
25733 if (!rtl_fw)
25734 return;
25735
25736 rtl_fw->phy_write = rtl8168_mdio_write;
25737 rtl_fw->phy_read = rtl8168_mdio_read;
25738 rtl_fw->mac_mcu_write = mac_mcu_write;
25739 rtl_fw->mac_mcu_read = mac_mcu_read;
25740 rtl_fw->fw_name = tp->fw_name;
25741 rtl_fw->dev = tp_to_dev(tp);
25742
25743 if (rtl8168_fw_request_firmware(rtl_fw))
25744 kfree(rtl_fw);
25745 else
25746 tp->rtl_fw = rtl_fw;
25747 }
25748 #endif
25749
rtl8168_open(struct net_device * dev)25750 static int rtl8168_open(struct net_device *dev)
25751 {
25752 struct rtl8168_private *tp = netdev_priv(dev);
25753 struct pci_dev *pdev = tp->pci_dev;
25754 unsigned long flags;
25755 int retval;
25756
25757 retval = -ENOMEM;
25758
25759 #ifdef ENABLE_R8168_PROCFS
25760 rtl8168_proc_init(dev);
25761 #endif
25762 rtl8168_set_rxbufsize(tp, dev);
25763 /*
25764 * Rx and Tx descriptors needs 256 bytes alignment.
25765 * pci_alloc_consistent provides more.
25766 */
25767 tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8168_TX_RING_BYTES,
25768 &tp->TxPhyAddr, GFP_KERNEL);
25769 if (!tp->TxDescArray)
25770 goto err_free_all_allocated_mem;
25771
25772 tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8168_RX_RING_BYTES,
25773 &tp->RxPhyAddr, GFP_KERNEL);
25774 if (!tp->RxDescArray)
25775 goto err_free_all_allocated_mem;
25776
25777 retval = rtl8168_init_ring(dev);
25778 if (retval < 0)
25779 goto err_free_all_allocated_mem;
25780
25781 retval = request_irq(dev->irq, rtl8168_interrupt, (tp->features & RTL_FEATURE_MSI) ? 0 : SA_SHIRQ, dev->name, dev);
25782 if (retval<0)
25783 goto err_free_all_allocated_mem;
25784
25785 if (netif_msg_probe(tp)) {
25786 printk(KERN_INFO "%s: 0x%lx, "
25787 "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "
25788 "IRQ %d\n",
25789 dev->name,
25790 dev->base_addr,
25791 dev->dev_addr[0], dev->dev_addr[1],
25792 dev->dev_addr[2], dev->dev_addr[3],
25793 dev->dev_addr[4], dev->dev_addr[5], dev->irq);
25794 }
25795
25796 #ifdef ENABLE_USE_FIRMWARE_FILE
25797 rtl8168_request_firmware(tp);
25798 #endif
25799
25800 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
25801 INIT_WORK(&tp->task, rtl8168_reset_task, dev);
25802 #else
25803 INIT_DELAYED_WORK(&tp->task, rtl8168_reset_task);
25804 #endif
25805
25806 pci_set_master(pdev);
25807
25808 #ifdef CONFIG_R8168_NAPI
25809 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
25810 RTL_NAPI_ENABLE(dev, &tp->napi);
25811 #endif
25812 #endif
25813 spin_lock_irqsave(&tp->lock, flags);
25814
25815 rtl8168_exit_oob(dev);
25816
25817 rtl8168_hw_init(dev);
25818
25819 rtl8168_hw_reset(dev);
25820
25821 rtl8168_powerup_pll(dev);
25822
25823 rtl8168_hw_ephy_config(dev);
25824
25825 rtl8168_hw_phy_config(dev);
25826
25827 rtl8168_hw_config(dev);
25828
25829 rtl8168_dsm(dev, DSM_IF_UP);
25830
25831 rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
25832
25833 spin_unlock_irqrestore(&tp->lock, flags);
25834
25835 if (tp->esd_flag == 0)
25836 rtl8168_request_esd_timer(dev);
25837
25838 rtl8168_request_link_timer(dev);
25839
25840 out:
25841
25842 return retval;
25843
25844 err_free_all_allocated_mem:
25845 if (tp->RxDescArray != NULL) {
25846 dma_free_coherent(&pdev->dev, R8168_RX_RING_BYTES, tp->RxDescArray,
25847 tp->RxPhyAddr);
25848 tp->RxDescArray = NULL;
25849 }
25850
25851 if (tp->TxDescArray != NULL) {
25852 dma_free_coherent(&pdev->dev, R8168_TX_RING_BYTES, tp->TxDescArray,
25853 tp->TxPhyAddr);
25854 tp->TxDescArray = NULL;
25855 }
25856
25857 goto out;
25858 }
25859
25860 static void
rtl8168_dsm(struct net_device * dev,int dev_state)25861 rtl8168_dsm(struct net_device *dev, int dev_state)
25862 {
25863 struct rtl8168_private *tp = netdev_priv(dev);
25864
25865 switch (dev_state) {
25866 case DSM_MAC_INIT:
25867 if ((tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6)) {
25868 if (RTL_R8(tp, MACDBG) & 0x80)
25869 RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) | GPIO_en);
25870 else
25871 RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) & ~GPIO_en);
25872 }
25873
25874 break;
25875 case DSM_NIC_GOTO_D3:
25876 case DSM_IF_DOWN:
25877 if ((tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6)) {
25878 if (RTL_R8(tp, MACDBG) & 0x80)
25879 RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) & ~GPIO_en);
25880 }
25881 break;
25882
25883 case DSM_NIC_RESUME_D3:
25884 case DSM_IF_UP:
25885 if ((tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6)) {
25886 if (RTL_R8(tp, MACDBG) & 0x80)
25887 RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) | GPIO_en);
25888 }
25889
25890 break;
25891 }
25892
25893 }
25894
25895 static void
set_offset70F(struct rtl8168_private * tp,u8 setting)25896 set_offset70F(struct rtl8168_private *tp, u8 setting)
25897 {
25898 u32 csi_tmp;
25899 u32 temp = (u32)setting;
25900 temp = temp << 24;
25901 /*set PCI configuration space offset 0x70F to setting*/
25902 /*When the register offset of PCI configuration space larger than 0xff, use CSI to access it.*/
25903
25904 csi_tmp = rtl8168_csi_read(tp, 0x70c) & 0x00ffffff;
25905 rtl8168_csi_write(tp, 0x70c, csi_tmp | temp);
25906 }
25907
25908 static void
set_offset79(struct rtl8168_private * tp,u8 setting)25909 set_offset79(struct rtl8168_private *tp, u8 setting)
25910 {
25911 //Set PCI configuration space offset 0x79 to setting
25912
25913 struct pci_dev *pdev = tp->pci_dev;
25914 u8 device_control;
25915
25916 if (hwoptimize & HW_PATCH_SOC_LAN) return;
25917
25918 pci_read_config_byte(pdev, 0x79, &device_control);
25919 device_control &= ~0x70;
25920 device_control |= setting;
25921 pci_write_config_byte(pdev, 0x79, device_control);
25922 }
25923
25924 static void
set_offset711(struct rtl8168_private * tp,u8 setting)25925 set_offset711(struct rtl8168_private *tp, u8 setting)
25926 {
25927 u32 csi_tmp;
25928 u32 temp = (u32)setting;
25929 temp &= 0x0f;
25930 temp = temp << 12;
25931 /*set PCI configuration space offset 0x711 to setting*/
25932
25933 csi_tmp = rtl8168_csi_read(tp, 0x710) & 0xffff0fff;
25934 rtl8168_csi_write(tp, 0x710, csi_tmp | temp);
25935 }
25936
25937 static void
rtl8168_hw_set_rx_packet_filter(struct net_device * dev)25938 rtl8168_hw_set_rx_packet_filter(struct net_device *dev)
25939 {
25940 struct rtl8168_private *tp = netdev_priv(dev);
25941 u32 mc_filter[2]; /* Multicast hash filter */
25942 int rx_mode;
25943 u32 tmp = 0;
25944
25945 if (dev->flags & IFF_PROMISC) {
25946 /* Unconditionally log net taps. */
25947 if (netif_msg_link(tp))
25948 printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n",
25949 dev->name);
25950
25951 rx_mode =
25952 AcceptBroadcast | AcceptMulticast | AcceptMyPhys |
25953 AcceptAllPhys;
25954 mc_filter[1] = mc_filter[0] = 0xffffffff;
25955 } else if ((netdev_mc_count(dev) > multicast_filter_limit)
25956 || (dev->flags & IFF_ALLMULTI)) {
25957 /* Too many to filter perfectly -- accept all multicasts. */
25958 rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
25959 mc_filter[1] = mc_filter[0] = 0xffffffff;
25960 } else {
25961 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
25962 struct dev_mc_list *mclist;
25963 unsigned int i;
25964
25965 rx_mode = AcceptBroadcast | AcceptMyPhys;
25966 mc_filter[1] = mc_filter[0] = 0;
25967 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
25968 i++, mclist = mclist->next) {
25969 int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
25970 mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
25971 rx_mode |= AcceptMulticast;
25972 }
25973 #else
25974 struct netdev_hw_addr *ha;
25975
25976 rx_mode = AcceptBroadcast | AcceptMyPhys;
25977 mc_filter[1] = mc_filter[0] = 0;
25978 netdev_for_each_mc_addr(ha, dev) {
25979 int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
25980 mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
25981 rx_mode |= AcceptMulticast;
25982 }
25983 #endif
25984 }
25985
25986 if (dev->features & NETIF_F_RXALL)
25987 rx_mode |= (AcceptErr | AcceptRunt);
25988
25989 tmp = mc_filter[0];
25990 mc_filter[0] = swab32(mc_filter[1]);
25991 mc_filter[1] = swab32(tmp);
25992
25993 tp->rtl8168_rx_config = rtl_chip_info[tp->chipset].RCR_Cfg;
25994 tmp = tp->rtl8168_rx_config | rx_mode | (RTL_R32(tp, RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask);
25995
25996 RTL_W32(tp, RxConfig, tmp);
25997 RTL_W32(tp, MAR0 + 0, mc_filter[0]);
25998 RTL_W32(tp, MAR0 + 4, mc_filter[1]);
25999 }
26000
26001 static void
rtl8168_set_rx_mode(struct net_device * dev)26002 rtl8168_set_rx_mode(struct net_device *dev)
26003 {
26004 struct rtl8168_private *tp = netdev_priv(dev);
26005 unsigned long flags;
26006
26007 spin_lock_irqsave(&tp->lock, flags);
26008
26009 rtl8168_hw_set_rx_packet_filter(dev);
26010
26011 spin_unlock_irqrestore(&tp->lock, flags);
26012 }
26013
26014 static void
rtl8168_hw_config(struct net_device * dev)26015 rtl8168_hw_config(struct net_device *dev)
26016 {
26017 struct rtl8168_private *tp = netdev_priv(dev);
26018 struct pci_dev *pdev = tp->pci_dev;
26019 u8 device_control;
26020 u16 mac_ocp_data;
26021 u32 csi_tmp;
26022
26023 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
26024 if (dev->mtu > ETH_DATA_LEN) {
26025 dev->features &= ~(NETIF_F_IP_CSUM);
26026 } else {
26027 dev->features |= NETIF_F_IP_CSUM;
26028 }
26029 #endif
26030
26031 RTL_W32(tp, RxConfig, (RX_DMA_BURST << RxCfgDMAShift));
26032
26033 rtl8168_hw_reset(dev);
26034
26035 rtl8168_enable_cfg9346_write(tp);
26036 if (tp->HwSuppAspmClkIntrLock) {
26037 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7);
26038 rtl8168_hw_aspm_clkreq_enable(tp, false);
26039 }
26040
26041 //clear io_rdy_l23
26042 switch (tp->mcfg) {
26043 case CFG_METHOD_20:
26044 case CFG_METHOD_21:
26045 case CFG_METHOD_22:
26046 case CFG_METHOD_23:
26047 case CFG_METHOD_24:
26048 case CFG_METHOD_25:
26049 case CFG_METHOD_26:
26050 case CFG_METHOD_27:
26051 case CFG_METHOD_28:
26052 case CFG_METHOD_29:
26053 case CFG_METHOD_30:
26054 case CFG_METHOD_31:
26055 case CFG_METHOD_32:
26056 case CFG_METHOD_33:
26057 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~BIT_1);
26058 break;
26059 }
26060
26061 //keep magic packet only
26062 switch (tp->mcfg) {
26063 case CFG_METHOD_16:
26064 case CFG_METHOD_17:
26065 case CFG_METHOD_18:
26066 case CFG_METHOD_19:
26067 case CFG_METHOD_20:
26068 case CFG_METHOD_21:
26069 case CFG_METHOD_22:
26070 case CFG_METHOD_23:
26071 case CFG_METHOD_24:
26072 case CFG_METHOD_25:
26073 case CFG_METHOD_26:
26074 case CFG_METHOD_27:
26075 case CFG_METHOD_28:
26076 case CFG_METHOD_29:
26077 case CFG_METHOD_30:
26078 case CFG_METHOD_31:
26079 case CFG_METHOD_32:
26080 case CFG_METHOD_33:
26081 csi_tmp = rtl8168_eri_read(tp, 0xDE, 1, ERIAR_ExGMAC);
26082 csi_tmp &= BIT_0;
26083 rtl8168_eri_write(tp, 0xDE, 1, csi_tmp, ERIAR_ExGMAC);
26084 break;
26085 }
26086
26087 RTL_W8(tp, MTPS, Reserved1_data);
26088
26089 tp->cp_cmd |= INTT_1;
26090 if (tp->use_timer_interrrupt)
26091 tp->cp_cmd |= PktCntrDisable;
26092 else
26093 tp->cp_cmd &= ~PktCntrDisable;
26094
26095 RTL_W16(tp, IntrMitigate, 0x5f51);
26096
26097 rtl8168_tally_counter_addr_fill(tp);
26098
26099 rtl8168_desc_addr_fill(tp);
26100
26101 /* Set DMA burst size and Interframe Gap Time */
26102 if (tp->mcfg == CFG_METHOD_1)
26103 RTL_W32(tp, TxConfig, (TX_DMA_BURST_512 << TxDMAShift) |
26104 (InterFrameGap << TxInterFrameGapShift));
26105 else
26106 RTL_W32(tp, TxConfig, (TX_DMA_BURST_unlimited << TxDMAShift) |
26107 (InterFrameGap << TxInterFrameGapShift));
26108
26109 if (tp->mcfg == CFG_METHOD_4) {
26110 set_offset70F(tp, 0x27);
26111
26112 RTL_W8(tp, DBG_reg, (0x0E << 4) | Fix_Nak_1 | Fix_Nak_2);
26113
26114 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26115
26116 //disable clock request.
26117 pci_write_config_byte(pdev, 0x81, 0x00);
26118
26119 if (dev->mtu > ETH_DATA_LEN) {
26120 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26121 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26122
26123 set_offset79(tp, 0x20);
26124 } else {
26125 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26126 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26127
26128 set_offset79(tp, 0x50);
26129 }
26130
26131 //rx checksum offload enable
26132 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
26133 tp->cp_cmd |= RxChkSum;
26134 #else
26135 dev->features |= NETIF_F_RXCSUM;
26136 #endif
26137
26138 tp->cp_cmd &= ~(EnableBist | Macdbgo_oe | Force_halfdup |
26139 Force_rxflow_en | Force_txflow_en | Cxpl_dbg_sel |
26140 ASF | PktCntrDisable | Macdbgo_sel);
26141 } else if (tp->mcfg == CFG_METHOD_5) {
26142
26143 set_offset70F(tp, 0x27);
26144
26145 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26146
26147 //disable clock request.
26148 pci_write_config_byte(pdev, 0x81, 0x00);
26149
26150 if (dev->mtu > ETH_DATA_LEN) {
26151 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26152 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26153
26154 set_offset79(tp, 0x20);
26155 } else {
26156 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26157 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26158
26159 set_offset79(tp, 0x50);
26160 }
26161
26162 //rx checksum offload enable
26163 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
26164 tp->cp_cmd |= RxChkSum;
26165 #else
26166 dev->features |= NETIF_F_RXCSUM;
26167 #endif
26168 } else if (tp->mcfg == CFG_METHOD_6) {
26169 set_offset70F(tp, 0x27);
26170
26171 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26172
26173 //disable clock request.
26174 pci_write_config_byte(pdev, 0x81, 0x00);
26175
26176 if (dev->mtu > ETH_DATA_LEN) {
26177 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26178 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26179
26180 set_offset79(tp, 0x20);
26181 } else {
26182 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26183 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26184
26185 set_offset79(tp, 0x50);
26186 }
26187
26188 //rx checksum offload enable
26189 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
26190 tp->cp_cmd |= RxChkSum;
26191 #else
26192 dev->features |= NETIF_F_RXCSUM;
26193 #endif
26194 } else if (tp->mcfg == CFG_METHOD_7) {
26195 set_offset70F(tp, 0x27);
26196
26197 rtl8168_eri_write(tp, 0x1EC, 1, 0x07, ERIAR_ASF);
26198
26199 //disable clock request.
26200 pci_write_config_byte(pdev, 0x81, 0x00);
26201
26202 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26203
26204 if (dev->mtu > ETH_DATA_LEN) {
26205 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26206 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26207
26208 set_offset79(tp, 0x20);
26209 } else {
26210 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26211 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26212
26213
26214 set_offset79(tp, 0x50);
26215 }
26216 } else if (tp->mcfg == CFG_METHOD_8) {
26217
26218 set_offset70F(tp, 0x27);
26219
26220 rtl8168_eri_write(tp, 0x1EC, 1, 0x07, ERIAR_ASF);
26221
26222 //disable clock request.
26223 pci_write_config_byte(pdev, 0x81, 0x00);
26224
26225 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26226
26227 RTL_W8(tp, 0xD1, 0x20);
26228
26229 if (dev->mtu > ETH_DATA_LEN) {
26230 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26231 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26232
26233 set_offset79(tp, 0x20);
26234 } else {
26235 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26236 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26237
26238 set_offset79(tp, 0x50);
26239 }
26240 } else if (tp->mcfg == CFG_METHOD_9) {
26241 set_offset70F(tp, 0x27);
26242
26243 /* disable clock request. */
26244 pci_write_config_byte(pdev, 0x81, 0x00);
26245
26246 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~BIT_4);
26247 RTL_W8(tp, DBG_reg, RTL_R8(tp, DBG_reg) | BIT_7 | BIT_1);
26248
26249 if (dev->mtu > ETH_DATA_LEN) {
26250 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26251 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26252
26253 set_offset79(tp, 0x20);
26254 } else {
26255 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26256 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26257
26258 set_offset79(tp, 0x50);
26259 }
26260
26261 RTL_W8(tp, TDFNR, 0x8);
26262
26263 } else if (tp->mcfg == CFG_METHOD_10) {
26264 set_offset70F(tp, 0x27);
26265
26266 RTL_W8(tp, DBG_reg, RTL_R8(tp, DBG_reg) | BIT_7 | BIT_1);
26267
26268 if (dev->mtu > ETH_DATA_LEN) {
26269 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26270 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
26271
26272 set_offset79(tp, 0x20);
26273 } else {
26274 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26275 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
26276
26277 set_offset79(tp, 0x50);
26278 }
26279
26280 RTL_W8(tp, TDFNR, 0x8);
26281
26282 RTL_W8(tp, Config1, RTL_R8(tp, Config1) | 0x10);
26283
26284 /* disable clock request. */
26285 pci_write_config_byte(pdev, 0x81, 0x00);
26286 } else if (tp->mcfg == CFG_METHOD_11 || tp->mcfg == CFG_METHOD_13) {
26287 set_offset70F(tp, 0x27);
26288 set_offset79(tp, 0x50);
26289
26290 if (dev->mtu > ETH_DATA_LEN)
26291 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26292 else
26293 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26294
26295 pci_write_config_byte(pdev, 0x81, 0x00);
26296
26297 RTL_W8(tp, Config1, RTL_R8(tp, Config1) | 0x10);
26298
26299 } else if (tp->mcfg == CFG_METHOD_12) {
26300 set_offset70F(tp, 0x27);
26301 set_offset79(tp, 0x50);
26302
26303 if (dev->mtu > ETH_DATA_LEN)
26304 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26305 else
26306 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26307
26308 pci_write_config_byte(pdev, 0x81, 0x01);
26309
26310 RTL_W8(tp, Config1, RTL_R8(tp, Config1) | 0x10);
26311
26312 } else if (tp->mcfg == CFG_METHOD_14 || tp->mcfg == CFG_METHOD_15) {
26313
26314 set_offset70F(tp, 0x27);
26315 set_offset79(tp, 0x50);
26316
26317 if (dev->mtu > ETH_DATA_LEN) {
26318 RTL_W8(tp, MTPS, 0x24);
26319 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
26320 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01);
26321 } else {
26322 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
26323 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01);
26324 }
26325
26326 RTL_W8(tp, 0xF3, RTL_R8(tp, 0xF3) | BIT_5);
26327 RTL_W8(tp, 0xF3, RTL_R8(tp, 0xF3) & ~BIT_5);
26328
26329 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_7 | BIT_6);
26330
26331 RTL_W8(tp, 0xD1, RTL_R8(tp, 0xD1) | BIT_2 | BIT_3);
26332
26333 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_6 | BIT_5 | BIT_4 | BIT_2 | BIT_1);
26334
26335 RTL_W8(tp, TDFNR, 0x8);
26336
26337 /*
26338 if (aspm)
26339 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7);
26340 */
26341
26342 RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_3);
26343
26344 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26345
26346 RTL_W8(tp, Config1, RTL_R8(tp, Config1) & ~0x10);
26347 } else if (tp->mcfg == CFG_METHOD_16 || tp->mcfg == CFG_METHOD_17) {
26348 set_offset70F(tp, 0x27);
26349 set_offset79(tp, 0x50);
26350
26351 rtl8168_eri_write(tp, 0xC0, 2, 0x0000, ERIAR_ExGMAC);
26352 rtl8168_eri_write(tp, 0xB8, 4, 0x00000000, ERIAR_ExGMAC);
26353 rtl8168_eri_write(tp, 0xC8, 4, 0x00100002, ERIAR_ExGMAC);
26354 rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
26355 csi_tmp = rtl8168_eri_read(tp, 0x1D0, 4, ERIAR_ExGMAC);
26356 csi_tmp |= BIT_1;
26357 rtl8168_eri_write(tp, 0x1D0, 1, csi_tmp, ERIAR_ExGMAC);
26358
26359 csi_tmp = rtl8168_eri_read(tp, 0xDC, 1, ERIAR_ExGMAC);
26360 csi_tmp &= ~BIT_0;
26361 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26362 csi_tmp |= BIT_0;
26363 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26364
26365 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
26366 RTL_W8(tp, 0xD3, RTL_R8(tp, 0xD3) & ~BIT_7);
26367 RTL_W8(tp, 0x1B, RTL_R8(tp, 0x1B) & ~0x07);
26368
26369 if (tp->mcfg == CFG_METHOD_16) {
26370 RTL_W32(tp, 0xB0, 0xEE480010);
26371 RTL_W8(tp, 0x1A, RTL_R8(tp, 0x1A) & ~(BIT_2|BIT_3));
26372 rtl8168_eri_write(tp, 0x1DC, 1, 0x64, ERIAR_ExGMAC);
26373 } else {
26374 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
26375 csi_tmp |= BIT_4;
26376 rtl8168_eri_write(tp, 0x1B0, 1, csi_tmp, ERIAR_ExGMAC);
26377 rtl8168_eri_write(tp, 0xCC, 4, 0x00000050, ERIAR_ExGMAC);
26378 rtl8168_eri_write(tp, 0xD0, 4, 0x07ff0060, ERIAR_ExGMAC);
26379 }
26380
26381 RTL_W8(tp, TDFNR, 0x8);
26382
26383 RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~PMSTS_En);
26384
26385 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6);
26386 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_6);
26387
26388 if (dev->mtu > ETH_DATA_LEN)
26389 RTL_W8(tp, MTPS, 0x27);
26390
26391 /* disable clock request. */
26392 pci_write_config_byte(pdev, 0x81, 0x00);
26393
26394 } else if (tp->mcfg == CFG_METHOD_18 || tp->mcfg == CFG_METHOD_19) {
26395 set_offset70F(tp, 0x27);
26396 set_offset79(tp, 0x50);
26397
26398 rtl8168_eri_write(tp, 0xC8, 4, 0x00100002, ERIAR_ExGMAC);
26399 rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
26400 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
26401 RTL_W8(tp, 0xD3, RTL_R8(tp, 0xD3) & ~BIT_7);
26402 csi_tmp = rtl8168_eri_read(tp, 0xDC, 1, ERIAR_ExGMAC);
26403 csi_tmp &= ~BIT_0;
26404 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26405 csi_tmp |= BIT_0;
26406 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26407
26408 /*
26409 if (aspm)
26410 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7);
26411 */
26412
26413 if (dev->mtu > ETH_DATA_LEN)
26414 RTL_W8(tp, MTPS, 0x27);
26415
26416 RTL_W8(tp, TDFNR, 0x8);
26417
26418 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6);
26419 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_6);
26420
26421 rtl8168_eri_write(tp, 0xC0, 2, 0x0000, ERIAR_ExGMAC);
26422 rtl8168_eri_write(tp, 0xB8, 4, 0x00000000, ERIAR_ExGMAC);
26423 RTL_W8(tp, 0x1B,RTL_R8(tp, 0x1B) & ~0x07);
26424
26425 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 1, ERIAR_ExGMAC);
26426 csi_tmp |= BIT_4;
26427 rtl8168_eri_write(tp, 0x1B0, 1, csi_tmp, ERIAR_ExGMAC);
26428 csi_tmp = rtl8168_eri_read(tp, 0x1d0, 1, ERIAR_ExGMAC);
26429 csi_tmp |= BIT_4 | BIT_1;
26430 rtl8168_eri_write(tp, 0x1d0, 1, csi_tmp, ERIAR_ExGMAC);
26431 rtl8168_eri_write(tp, 0xCC, 4, 0x00000050, ERIAR_ExGMAC);
26432 rtl8168_eri_write(tp, 0xd0, 4, 0x00000060, ERIAR_ExGMAC);
26433 } else if (tp->mcfg == CFG_METHOD_20) {
26434 set_offset70F(tp, 0x27);
26435 set_offset79(tp, 0x50);
26436
26437 rtl8168_eri_write(tp, 0xC8, 4, 0x00100002, ERIAR_ExGMAC);
26438 rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
26439 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
26440 RTL_W8(tp, 0xD3, RTL_R8(tp, 0xD3) & ~BIT_7);
26441 csi_tmp = rtl8168_eri_read(tp, 0xDC, 1, ERIAR_ExGMAC);
26442 csi_tmp &= ~BIT_0;
26443 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26444 csi_tmp |= BIT_0;
26445 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26446
26447 /*
26448 if (aspm)
26449 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7);
26450 */
26451
26452 if (dev->mtu > ETH_DATA_LEN)
26453 RTL_W8(tp, MTPS, 0x27);
26454
26455 RTL_W8(tp, TDFNR, 0x8);
26456
26457 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6);
26458 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_6);
26459 rtl8168_eri_write(tp, 0xC0, 2, 0x0000, ERIAR_ExGMAC);
26460 rtl8168_eri_write(tp, 0xB8, 4, 0x00000000, ERIAR_ExGMAC);
26461
26462 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 1, ERIAR_ExGMAC);
26463 csi_tmp |= BIT_4;
26464 rtl8168_eri_write(tp, 0x1B0, 1, csi_tmp, ERIAR_ExGMAC);
26465 csi_tmp = rtl8168_eri_read(tp, 0x1d0, 1, ERIAR_ExGMAC);
26466 csi_tmp |= BIT_4 | BIT_1;
26467 rtl8168_eri_write(tp, 0x1d0, 1, csi_tmp, ERIAR_ExGMAC);
26468 rtl8168_eri_write(tp, 0xCC, 4, 0x00000050, ERIAR_ExGMAC);
26469 rtl8168_eri_write(tp, 0xd0, 4, 0x00000060, ERIAR_ExGMAC);
26470 } else if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
26471 tp->mcfg == CFG_METHOD_24 || tp->mcfg == CFG_METHOD_25 ||
26472 tp->mcfg == CFG_METHOD_26 || tp->mcfg == CFG_METHOD_29 ||
26473 tp->mcfg == CFG_METHOD_30) {
26474 set_offset70F(tp, 0x27);
26475 set_offset79(tp, 0x50);
26476 if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22)
26477 set_offset711(tp, 0x04);
26478
26479 rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC);
26480 rtl8168_eri_write(tp, 0xCC, 1, 0x38, ERIAR_ExGMAC);
26481 rtl8168_eri_write(tp, 0xD0, 1, 0x48, ERIAR_ExGMAC);
26482 rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
26483
26484 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
26485
26486 csi_tmp = rtl8168_eri_read(tp, 0xDC, 1, ERIAR_ExGMAC);
26487 csi_tmp &= ~BIT_0;
26488 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26489 csi_tmp |= BIT_0;
26490 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26491
26492 if (tp->mcfg == CFG_METHOD_26) {
26493 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD3C0);
26494 mac_ocp_data &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
26495 mac_ocp_data |= 0x0FFF;
26496 rtl8168_mac_ocp_write(tp, 0xD3C0, mac_ocp_data);
26497 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD3C2);
26498 mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
26499 rtl8168_mac_ocp_write(tp, 0xD3C2, mac_ocp_data);
26500 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD3C4);
26501 mac_ocp_data |= BIT_0;
26502 rtl8168_mac_ocp_write(tp, 0xD3C4, mac_ocp_data);
26503 } else if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30) {
26504
26505 if (tp->RequireAdjustUpsTxLinkPulseTiming) {
26506 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD412);
26507 mac_ocp_data &= ~(0x0FFF);
26508 mac_ocp_data |= tp->SwrCnt1msIni;
26509 rtl8168_mac_ocp_write(tp, 0xD412, mac_ocp_data);
26510 }
26511
26512 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xE056);
26513 mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4);
26514 //mac_ocp_data |= (BIT_6 | BIT_5 | BIT_4);
26515 rtl8168_mac_ocp_write(tp, 0xE056, mac_ocp_data);
26516
26517 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xE052);
26518 mac_ocp_data &= ~(BIT_15 | BIT_14 | BIT_13 | BIT_3);
26519 mac_ocp_data |= BIT_15;
26520 //mac_ocp_data |= BIT_3;
26521 rtl8168_mac_ocp_write(tp, 0xE052, mac_ocp_data);
26522
26523 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD420);
26524 mac_ocp_data &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
26525 mac_ocp_data |= 0x45F;
26526 rtl8168_mac_ocp_write(tp, 0xD420, mac_ocp_data);
26527
26528 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xE0D6);
26529 mac_ocp_data &= ~(BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
26530 mac_ocp_data |= 0x17F;
26531 rtl8168_mac_ocp_write(tp, 0xE0D6, mac_ocp_data);
26532 }
26533
26534 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26535
26536 RTL_W8(tp, 0x1B, RTL_R8(tp, 0x1B) & ~0x07);
26537
26538 RTL_W8(tp, TDFNR, 0x4);
26539
26540 RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~PMSTS_En);
26541
26542 /*
26543 if (aspm)
26544 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7);
26545 */
26546
26547 if (dev->mtu > ETH_DATA_LEN)
26548 RTL_W8(tp, MTPS, 0x27);
26549
26550 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6);
26551 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_6);
26552
26553 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_7);
26554
26555 rtl8168_eri_write(tp, 0xC0, 2, 0x0000, ERIAR_ExGMAC);
26556 rtl8168_eri_write(tp, 0xB8, 4, 0x00000000, ERIAR_ExGMAC);
26557
26558 if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30) {
26559 rtl8168_mac_ocp_write(tp, 0xE054, 0x0000);
26560
26561 rtl8168_eri_write(tp, 0x5F0, 2, 0x4000, ERIAR_ExGMAC);
26562 } else {
26563 rtl8168_eri_write(tp, 0x5F0, 2, 0x4F87, ERIAR_ExGMAC);
26564 }
26565
26566 if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30) {
26567 csi_tmp = rtl8168_eri_read(tp, 0xDC, 4, ERIAR_ExGMAC);
26568 csi_tmp |= (BIT_2 | BIT_3 | BIT_4);
26569 rtl8168_eri_write(tp, 0xDC, 4, csi_tmp, ERIAR_ExGMAC);
26570 }
26571
26572 if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
26573 tp->mcfg == CFG_METHOD_24 || tp->mcfg == CFG_METHOD_25) {
26574 rtl8168_mac_ocp_write(tp, 0xC140, 0xFFFF);
26575 } else if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30) {
26576 rtl8168_mac_ocp_write(tp, 0xC140, 0xFFFF);
26577 rtl8168_mac_ocp_write(tp, 0xC142, 0xFFFF);
26578 }
26579
26580 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
26581 csi_tmp &= ~BIT_12;
26582 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
26583
26584 if (tp->mcfg == CFG_METHOD_29 || tp->mcfg == CFG_METHOD_30) {
26585 csi_tmp = rtl8168_eri_read(tp, 0x2FC, 1, ERIAR_ExGMAC);
26586 csi_tmp &= ~(BIT_2);
26587 rtl8168_eri_write(tp, 0x2FC, 1, csi_tmp, ERIAR_ExGMAC);
26588 } else {
26589 csi_tmp = rtl8168_eri_read(tp, 0x2FC, 1, ERIAR_ExGMAC);
26590 csi_tmp &= ~(BIT_0 | BIT_1 | BIT_2);
26591 csi_tmp |= BIT_0;
26592 rtl8168_eri_write(tp, 0x2FC, 1, csi_tmp, ERIAR_ExGMAC);
26593 }
26594
26595 csi_tmp = rtl8168_eri_read(tp, 0x1D0, 1, ERIAR_ExGMAC);
26596 csi_tmp |= BIT_1;
26597 rtl8168_eri_write(tp, 0x1D0, 1, csi_tmp, ERIAR_ExGMAC);
26598 } else if (tp->mcfg == CFG_METHOD_23 || tp->mcfg == CFG_METHOD_27 ||
26599 tp->mcfg == CFG_METHOD_28) {
26600 set_offset70F(tp, 0x27);
26601 set_offset79(tp, 0x50);
26602
26603 rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC);
26604 rtl8168_eri_write(tp, 0xCC, 1, 0x2F, ERIAR_ExGMAC);
26605 rtl8168_eri_write(tp, 0xD0, 1, 0x5F, ERIAR_ExGMAC);
26606 rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
26607
26608 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
26609
26610 csi_tmp = rtl8168_eri_read(tp, 0xDC, 1, ERIAR_ExGMAC);
26611 csi_tmp &= ~BIT_0;
26612 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26613 csi_tmp |= BIT_0;
26614 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26615
26616 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26617
26618 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6);
26619 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_6);
26620
26621 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_7);
26622
26623 rtl8168_eri_write(tp, 0xC0, 2, 0x0000, ERIAR_ExGMAC);
26624 rtl8168_eri_write(tp, 0xB8, 4, 0x00000000, ERIAR_ExGMAC);
26625 RTL_W8(tp, 0x1B, RTL_R8(tp, 0x1B) & ~0x07);
26626
26627 RTL_W8(tp, TDFNR, 0x4);
26628
26629 /*
26630 if (aspm)
26631 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7);
26632 */
26633
26634 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
26635 csi_tmp &= ~BIT_12;
26636 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
26637
26638 csi_tmp = rtl8168_eri_read(tp, 0x2FC, 1, ERIAR_ExGMAC);
26639 csi_tmp &= ~(BIT_0 | BIT_1 | BIT_2);
26640 csi_tmp |= (BIT_0 | BIT_1);
26641 rtl8168_eri_write(tp, 0x2FC, 1, csi_tmp, ERIAR_ExGMAC);
26642
26643 csi_tmp = rtl8168_eri_read(tp, 0x1D0, 1, ERIAR_ExGMAC);
26644 csi_tmp |= BIT_1;
26645 rtl8168_eri_write(tp, 0x1D0, 1, csi_tmp, ERIAR_ExGMAC);
26646
26647 if (dev->mtu > ETH_DATA_LEN)
26648 RTL_W8(tp, MTPS, 0x27);
26649
26650 if (tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28) {
26651 rtl8168_oob_mutex_lock(tp);
26652 rtl8168_eri_write(tp, 0x5F0, 2, 0x4F87, ERIAR_ExGMAC);
26653 rtl8168_oob_mutex_unlock(tp);
26654 }
26655
26656 rtl8168_mac_ocp_write(tp, 0xC140, 0xFFFF);
26657 rtl8168_mac_ocp_write(tp, 0xC142, 0xFFFF);
26658
26659 if (tp->mcfg == CFG_METHOD_28) {
26660 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD3E2);
26661 mac_ocp_data &= 0xF000;
26662 mac_ocp_data |= 0xAFD;
26663 rtl8168_mac_ocp_write(tp, 0xD3E2, mac_ocp_data);
26664
26665 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD3E4);
26666 mac_ocp_data &= 0xFF00;
26667 rtl8168_mac_ocp_write(tp, 0xD3E4, mac_ocp_data);
26668
26669 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xE860);
26670 mac_ocp_data |= BIT_7;
26671 rtl8168_mac_ocp_write(tp, 0xE860, mac_ocp_data);
26672 }
26673 } else if (tp->mcfg == CFG_METHOD_31 || tp->mcfg == CFG_METHOD_32 ||
26674 tp->mcfg == CFG_METHOD_33) {
26675 set_offset70F(tp, 0x27);
26676 set_offset79(tp, 0x50);
26677
26678 rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC);
26679 rtl8168_eri_write(tp, 0xCC, 1, 0x2F, ERIAR_ExGMAC);
26680 rtl8168_eri_write(tp, 0xD0, 1, 0x5F, ERIAR_ExGMAC);
26681 rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
26682
26683 RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
26684
26685 csi_tmp = rtl8168_eri_read(tp, 0xDC, 1, ERIAR_ExGMAC);
26686 csi_tmp &= ~BIT_0;
26687 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26688 csi_tmp |= BIT_0;
26689 rtl8168_eri_write(tp, 0xDC, 1, csi_tmp, ERIAR_ExGMAC);
26690
26691 if (tp->RequireAdjustUpsTxLinkPulseTiming) {
26692 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD412);
26693 mac_ocp_data &= ~(0x0FFF);
26694 mac_ocp_data |= tp->SwrCnt1msIni;
26695 rtl8168_mac_ocp_write(tp, 0xD412, mac_ocp_data);
26696 }
26697
26698 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xE056);
26699 mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4);
26700 rtl8168_mac_ocp_write(tp, 0xE056, mac_ocp_data);
26701 if (FALSE == HW_SUPP_SERDES_PHY(tp))
26702 rtl8168_mac_ocp_write(tp, 0xEA80, 0x0003);
26703 else
26704 rtl8168_mac_ocp_write(tp, 0xEA80, 0x0000);
26705
26706 rtl8168_oob_mutex_lock(tp);
26707 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xE052);
26708 mac_ocp_data &= ~(BIT_3 | BIT_0);
26709 rtl8168_mac_ocp_write(tp, 0xE052, mac_ocp_data);
26710 rtl8168_oob_mutex_unlock(tp);
26711
26712 mac_ocp_data = rtl8168_mac_ocp_read(tp, 0xD420);
26713 mac_ocp_data &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
26714 mac_ocp_data |= 0x45F;
26715 rtl8168_mac_ocp_write(tp, 0xD420, mac_ocp_data);
26716
26717 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26718
26719 RTL_W8(tp, 0x1B, RTL_R8(tp, 0x1B) & ~0x07);
26720
26721 RTL_W8(tp, TDFNR, 0x4);
26722
26723 RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~PMSTS_En);
26724
26725 /*
26726 if (aspm)
26727 RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7);
26728 */
26729
26730 if (dev->mtu > ETH_DATA_LEN)
26731 RTL_W8(tp, MTPS, 0x27);
26732
26733 if (FALSE == HW_SUPP_SERDES_PHY(tp)) {
26734 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6);
26735 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_6);
26736 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_7);
26737 } else {
26738 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_6);
26739 RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_6);
26740 RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_7);
26741 }
26742
26743 rtl8168_eri_write(tp, 0xC0, 2, 0x0000, ERIAR_ExGMAC);
26744 rtl8168_eri_write(tp, 0xB8, 4, 0x00000000, ERIAR_ExGMAC);
26745
26746 rtl8168_oob_mutex_lock(tp);
26747 rtl8168_eri_write(tp, 0x5F0, 2, 0x4000, ERIAR_ExGMAC);
26748 rtl8168_oob_mutex_unlock(tp);
26749
26750 if (tp->mcfg == CFG_METHOD_32 || tp->mcfg == CFG_METHOD_33) {
26751 csi_tmp = rtl8168_eri_read(tp, 0xD4, 4, ERIAR_ExGMAC);
26752 csi_tmp |= BIT_4;
26753 rtl8168_eri_write(tp, 0xD4, 4, csi_tmp, ERIAR_ExGMAC);
26754 }
26755
26756 rtl8168_mac_ocp_write(tp, 0xC140, 0xFFFF);
26757 rtl8168_mac_ocp_write(tp, 0xC142, 0xFFFF);
26758
26759 csi_tmp = rtl8168_eri_read(tp, 0x1B0, 4, ERIAR_ExGMAC);
26760 csi_tmp &= ~BIT_12;
26761 rtl8168_eri_write(tp, 0x1B0, 4, csi_tmp, ERIAR_ExGMAC);
26762
26763 csi_tmp = rtl8168_eri_read(tp, 0x2FC, 1, ERIAR_ExGMAC);
26764 csi_tmp &= ~(BIT_0 | BIT_1);
26765 csi_tmp |= BIT_0;
26766 rtl8168_eri_write(tp, 0x2FC, 1, csi_tmp, ERIAR_ExGMAC);
26767
26768 csi_tmp = rtl8168_eri_read(tp, 0x1D0, 1, ERIAR_ExGMAC);
26769 csi_tmp &= ~BIT_1;
26770 rtl8168_eri_write(tp, 0x1D0, 1, csi_tmp, ERIAR_ExGMAC);
26771 } else if (tp->mcfg == CFG_METHOD_1) {
26772 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26773
26774 if (dev->mtu > ETH_DATA_LEN) {
26775 pci_read_config_byte(pdev, 0x69, &device_control);
26776 device_control &= ~0x70;
26777 device_control |= 0x28;
26778 pci_write_config_byte(pdev, 0x69, device_control);
26779 } else {
26780 pci_read_config_byte(pdev, 0x69, &device_control);
26781 device_control &= ~0x70;
26782 device_control |= 0x58;
26783 pci_write_config_byte(pdev, 0x69, device_control);
26784 }
26785 } else if (tp->mcfg == CFG_METHOD_2) {
26786 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26787
26788 if (dev->mtu > ETH_DATA_LEN) {
26789 pci_read_config_byte(pdev, 0x69, &device_control);
26790 device_control &= ~0x70;
26791 device_control |= 0x28;
26792 pci_write_config_byte(pdev, 0x69, device_control);
26793
26794 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0));
26795 } else {
26796 pci_read_config_byte(pdev, 0x69, &device_control);
26797 device_control &= ~0x70;
26798 device_control |= 0x58;
26799 pci_write_config_byte(pdev, 0x69, device_control);
26800
26801 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0));
26802 }
26803 } else if (tp->mcfg == CFG_METHOD_3) {
26804 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
26805
26806 if (dev->mtu > ETH_DATA_LEN) {
26807 pci_read_config_byte(pdev, 0x69, &device_control);
26808 device_control &= ~0x70;
26809 device_control |= 0x28;
26810 pci_write_config_byte(pdev, 0x69, device_control);
26811
26812 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0));
26813 } else {
26814 pci_read_config_byte(pdev, 0x69, &device_control);
26815 device_control &= ~0x70;
26816 device_control |= 0x58;
26817 pci_write_config_byte(pdev, 0x69, device_control);
26818
26819 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0));
26820 }
26821 }
26822
26823 if ((tp->mcfg == CFG_METHOD_1) || (tp->mcfg == CFG_METHOD_2) || (tp->mcfg == CFG_METHOD_3)) {
26824 /* csum offload command for RTL8168B/8111B */
26825 tp->tx_tcp_csum_cmd = TxTCPCS;
26826 tp->tx_udp_csum_cmd = TxUDPCS;
26827 tp->tx_ip_csum_cmd = TxIPCS;
26828 tp->tx_ipv6_csum_cmd = 0;
26829 } else {
26830 /* csum offload command for RTL8168C/8111C and RTL8168CP/8111CP */
26831 tp->tx_tcp_csum_cmd = TxTCPCS_C;
26832 tp->tx_udp_csum_cmd = TxUDPCS_C;
26833 tp->tx_ip_csum_cmd = TxIPCS_C;
26834 tp->tx_ipv6_csum_cmd = TxIPV6F_C;
26835 }
26836
26837
26838 //other hw parameters
26839 if (tp->mcfg == CFG_METHOD_21 || tp->mcfg == CFG_METHOD_22 ||
26840 tp->mcfg == CFG_METHOD_23 || tp->mcfg == CFG_METHOD_24 ||
26841 tp->mcfg == CFG_METHOD_25 || tp->mcfg == CFG_METHOD_26 ||
26842 tp->mcfg == CFG_METHOD_27 || tp->mcfg == CFG_METHOD_28)
26843 rtl8168_eri_write(tp, 0x2F8, 2, 0x1D8F, ERIAR_ExGMAC);
26844
26845 if (tp->bios_setting & BIT_28) {
26846 if (tp->mcfg == CFG_METHOD_18 || tp->mcfg == CFG_METHOD_19 ||
26847 tp->mcfg == CFG_METHOD_20) {
26848 u32 gphy_val;
26849
26850 rtl8168_mdio_write(tp, 0x1F, 0x0007);
26851 rtl8168_mdio_write(tp, 0x1E, 0x002C);
26852 gphy_val = rtl8168_mdio_read(tp, 0x16);
26853 gphy_val |= BIT_10;
26854 rtl8168_mdio_write(tp, 0x16, gphy_val);
26855 rtl8168_mdio_write(tp, 0x1F, 0x0005);
26856 rtl8168_mdio_write(tp, 0x05, 0x8B80);
26857 gphy_val = rtl8168_mdio_read(tp, 0x06);
26858 gphy_val |= BIT_7;
26859 rtl8168_mdio_write(tp, 0x06, gphy_val);
26860 rtl8168_mdio_write(tp, 0x1F, 0x0000);
26861 }
26862 }
26863
26864 rtl8168_hw_clear_timer_int(dev);
26865
26866 rtl8168_enable_exit_l1_mask(tp);
26867
26868 switch (tp->mcfg) {
26869 case CFG_METHOD_25:
26870 rtl8168_mac_ocp_write(tp, 0xD3C0, 0x0B00);
26871 rtl8168_mac_ocp_write(tp, 0xD3C2, 0x0000);
26872 break;
26873 case CFG_METHOD_29:
26874 case CFG_METHOD_30:
26875 rtl8168_mac_ocp_write(tp, 0xE098, 0x0AA2);
26876 break;
26877 case CFG_METHOD_31:
26878 case CFG_METHOD_32:
26879 case CFG_METHOD_33:
26880 rtl8168_mac_ocp_write(tp, 0xE098, 0xC302);
26881 break;
26882 }
26883
26884 switch (tp->mcfg) {
26885 case CFG_METHOD_21:
26886 case CFG_METHOD_22:
26887 case CFG_METHOD_23:
26888 case CFG_METHOD_24:
26889 case CFG_METHOD_25:
26890 case CFG_METHOD_26:
26891 case CFG_METHOD_27:
26892 case CFG_METHOD_28:
26893 case CFG_METHOD_29:
26894 case CFG_METHOD_30:
26895 case CFG_METHOD_31:
26896 case CFG_METHOD_32:
26897 case CFG_METHOD_33:
26898 if (aspm) {
26899 rtl8168_init_pci_offset_99(tp);
26900 }
26901 break;
26902 }
26903 switch (tp->mcfg) {
26904 case CFG_METHOD_24:
26905 case CFG_METHOD_25:
26906 case CFG_METHOD_26:
26907 case CFG_METHOD_27:
26908 case CFG_METHOD_28:
26909 case CFG_METHOD_29:
26910 case CFG_METHOD_30:
26911 case CFG_METHOD_31:
26912 case CFG_METHOD_32:
26913 case CFG_METHOD_33:
26914 if (aspm) {
26915 rtl8168_init_pci_offset_180(tp);
26916 }
26917 break;
26918 }
26919
26920 tp->cp_cmd &= ~(EnableBist | Macdbgo_oe | Force_halfdup |
26921 Force_rxflow_en | Force_txflow_en | Cxpl_dbg_sel |
26922 ASF | Macdbgo_sel);
26923
26924 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
26925 RTL_W16(tp, CPlusCmd, tp->cp_cmd);
26926 #else
26927 rtl8168_hw_set_features(dev, dev->features);
26928 #endif
26929
26930 switch (tp->mcfg) {
26931 case CFG_METHOD_16:
26932 case CFG_METHOD_17:
26933 case CFG_METHOD_18:
26934 case CFG_METHOD_19:
26935 case CFG_METHOD_20:
26936 case CFG_METHOD_21:
26937 case CFG_METHOD_22:
26938 case CFG_METHOD_23:
26939 case CFG_METHOD_24:
26940 case CFG_METHOD_25:
26941 case CFG_METHOD_26:
26942 case CFG_METHOD_27:
26943 case CFG_METHOD_28:
26944 case CFG_METHOD_29:
26945 case CFG_METHOD_30:
26946 case CFG_METHOD_31:
26947 case CFG_METHOD_32:
26948 case CFG_METHOD_33: {
26949 int timeout;
26950 for (timeout = 0; timeout < 10; timeout++) {
26951 if ((rtl8168_eri_read(tp, 0x1AE, 2, ERIAR_ExGMAC) & BIT_13)==0)
26952 break;
26953 mdelay(1);
26954 }
26955 }
26956 break;
26957 }
26958
26959 RTL_W16(tp, RxMaxSize, tp->rx_buf_sz);
26960
26961 rtl8168_disable_rxdvgate(dev);
26962
26963 if (tp->mcfg == CFG_METHOD_11 || tp->mcfg == CFG_METHOD_12)
26964 rtl8168_mac_loopback_test(tp);
26965
26966 if (!tp->pci_cfg_is_read) {
26967 pci_read_config_byte(pdev, PCI_COMMAND, &tp->pci_cfg_space.cmd);
26968 pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &tp->pci_cfg_space.io_base_l);
26969 pci_read_config_word(pdev, PCI_BASE_ADDRESS_0 + 2, &tp->pci_cfg_space.io_base_h);
26970 pci_read_config_word(pdev, PCI_BASE_ADDRESS_2, &tp->pci_cfg_space.mem_base_l);
26971 pci_read_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, &tp->pci_cfg_space.mem_base_h);
26972 pci_read_config_word(pdev, PCI_BASE_ADDRESS_3, &tp->pci_cfg_space.resv_0x1c_l);
26973 pci_read_config_word(pdev, PCI_BASE_ADDRESS_3 + 2, &tp->pci_cfg_space.resv_0x1c_h);
26974 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tp->pci_cfg_space.ilr);
26975 pci_read_config_word(pdev, PCI_BASE_ADDRESS_4, &tp->pci_cfg_space.resv_0x20_l);
26976 pci_read_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, &tp->pci_cfg_space.resv_0x20_h);
26977 pci_read_config_word(pdev, PCI_BASE_ADDRESS_5, &tp->pci_cfg_space.resv_0x24_l);
26978 pci_read_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, &tp->pci_cfg_space.resv_0x24_h);
26979 pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->pci_cfg_space.resv_0x2c_l);
26980 pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, &tp->pci_cfg_space.resv_0x2c_h);
26981 if (tp->HwPcieSNOffset > 0) {
26982 tp->pci_cfg_space.pci_sn_l = rtl8168_csi_read(tp, tp->HwPcieSNOffset);
26983 tp->pci_cfg_space.pci_sn_h = rtl8168_csi_read(tp, tp->HwPcieSNOffset + 4);
26984 }
26985
26986 tp->pci_cfg_is_read = 1;
26987 }
26988
26989 rtl8168_dsm(dev, DSM_MAC_INIT);
26990
26991 /* Set Rx packet filter */
26992 rtl8168_hw_set_rx_packet_filter(dev);
26993
26994 #ifdef ENABLE_DASH_SUPPORT
26995 if (tp->DASH && !tp->dash_printer_enabled)
26996 NICChkTypeEnableDashInterrupt(tp);
26997 #endif
26998
26999 if (tp->HwSuppAspmClkIntrLock)
27000 rtl8168_hw_aspm_clkreq_enable(tp, true);
27001
27002 rtl8168_disable_cfg9346_write(tp);
27003
27004 udelay(10);
27005 }
27006
27007 static void
rtl8168_hw_start(struct net_device * dev)27008 rtl8168_hw_start(struct net_device *dev)
27009 {
27010 struct rtl8168_private *tp = netdev_priv(dev);
27011
27012 RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb);
27013
27014 rtl8168_enable_hw_interrupt(tp);
27015 }
27016
27017 static int
rtl8168_change_mtu(struct net_device * dev,int new_mtu)27018 rtl8168_change_mtu(struct net_device *dev,
27019 int new_mtu)
27020 {
27021 struct rtl8168_private *tp = netdev_priv(dev);
27022 int ret = 0;
27023 unsigned long flags;
27024
27025 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
27026 if (new_mtu < ETH_MIN_MTU)
27027 return -EINVAL;
27028 else if (new_mtu > tp->max_jumbo_frame_size)
27029 new_mtu = tp->max_jumbo_frame_size;
27030 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
27031
27032 spin_lock_irqsave(&tp->lock, flags);
27033 dev->mtu = new_mtu;
27034 spin_unlock_irqrestore(&tp->lock, flags);
27035
27036 if (!netif_running(dev))
27037 goto out;
27038
27039 rtl8168_down(dev);
27040
27041 spin_lock_irqsave(&tp->lock, flags);
27042
27043 rtl8168_set_rxbufsize(tp, dev);
27044
27045 ret = rtl8168_init_ring(dev);
27046
27047 if (ret < 0) {
27048 spin_unlock_irqrestore(&tp->lock, flags);
27049 goto err_out;
27050 }
27051
27052 #ifdef CONFIG_R8168_NAPI
27053 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27054 RTL_NAPI_ENABLE(dev, &tp->napi);
27055 #endif
27056 #endif//CONFIG_R8168_NAPI
27057
27058 netif_stop_queue(dev);
27059 netif_carrier_off(dev);
27060 rtl8168_hw_config(dev);
27061 spin_unlock_irqrestore(&tp->lock, flags);
27062
27063 rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
27064
27065 mod_timer(&tp->esd_timer, jiffies + RTL8168_ESD_TIMEOUT);
27066 mod_timer(&tp->link_timer, jiffies + RTL8168_LINK_TIMEOUT);
27067 out:
27068 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
27069 netdev_update_features(dev);
27070 #endif
27071
27072 err_out:
27073 return ret;
27074 }
27075
27076 static inline void
rtl8168_make_unusable_by_asic(struct RxDesc * desc)27077 rtl8168_make_unusable_by_asic(struct RxDesc *desc)
27078 {
27079 desc->addr = 0x0badbadbadbadbadull;
27080 desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
27081 }
27082
27083 static void
rtl8168_free_rx_skb(struct rtl8168_private * tp,struct sk_buff ** sk_buff,struct RxDesc * desc)27084 rtl8168_free_rx_skb(struct rtl8168_private *tp,
27085 struct sk_buff **sk_buff,
27086 struct RxDesc *desc)
27087 {
27088 struct pci_dev *pdev = tp->pci_dev;
27089
27090 dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz,
27091 DMA_FROM_DEVICE);
27092 dev_kfree_skb(*sk_buff);
27093 *sk_buff = NULL;
27094 rtl8168_make_unusable_by_asic(desc);
27095 }
27096
27097 static inline void
rtl8168_mark_to_asic(struct RxDesc * desc,u32 rx_buf_sz)27098 rtl8168_mark_to_asic(struct RxDesc *desc,
27099 u32 rx_buf_sz)
27100 {
27101 u32 eor = le32_to_cpu(desc->opts1) & RingEnd;
27102
27103 desc->opts1 = cpu_to_le32(DescOwn | eor | rx_buf_sz);
27104 }
27105
27106 static inline void
rtl8168_map_to_asic(struct RxDesc * desc,dma_addr_t mapping,u32 rx_buf_sz)27107 rtl8168_map_to_asic(struct RxDesc *desc,
27108 dma_addr_t mapping,
27109 u32 rx_buf_sz)
27110 {
27111 desc->addr = cpu_to_le64(mapping);
27112 wmb();
27113 rtl8168_mark_to_asic(desc, rx_buf_sz);
27114 }
27115
27116 static int
rtl8168_alloc_rx_skb(struct rtl8168_private * tp,struct sk_buff ** sk_buff,struct RxDesc * desc,int rx_buf_sz,u8 in_intr)27117 rtl8168_alloc_rx_skb(struct rtl8168_private *tp,
27118 struct sk_buff **sk_buff,
27119 struct RxDesc *desc,
27120 int rx_buf_sz,
27121 u8 in_intr)
27122 {
27123 struct sk_buff *skb;
27124 dma_addr_t mapping;
27125 int ret = 0;
27126
27127 if (in_intr)
27128 skb = RTL_ALLOC_SKB_INTR(tp, rx_buf_sz + RTK_RX_ALIGN);
27129 else
27130 skb = dev_alloc_skb(rx_buf_sz + RTK_RX_ALIGN);
27131
27132 if (unlikely(!skb))
27133 goto err_out;
27134
27135 skb_reserve(skb, RTK_RX_ALIGN);
27136
27137 mapping = dma_map_single(tp_to_dev(tp), skb->data, rx_buf_sz,
27138 DMA_FROM_DEVICE);
27139 if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) {
27140 if (unlikely(net_ratelimit()))
27141 netif_err(tp, drv, tp->dev, "Failed to map RX DMA!\n");
27142 goto err_out;
27143 }
27144
27145 *sk_buff = skb;
27146 rtl8168_map_to_asic(desc, mapping, rx_buf_sz);
27147 out:
27148 return ret;
27149
27150 err_out:
27151 if (skb)
27152 dev_kfree_skb(skb);
27153 ret = -ENOMEM;
27154 rtl8168_make_unusable_by_asic(desc);
27155 goto out;
27156 }
27157
27158 static void
rtl8168_rx_clear(struct rtl8168_private * tp)27159 rtl8168_rx_clear(struct rtl8168_private *tp)
27160 {
27161 int i;
27162
27163 for (i = 0; i < NUM_RX_DESC; i++) {
27164 if (tp->Rx_skbuff[i])
27165 rtl8168_free_rx_skb(tp, tp->Rx_skbuff + i,
27166 tp->RxDescArray + i);
27167 }
27168 }
27169
27170 static u32
rtl8168_rx_fill(struct rtl8168_private * tp,struct net_device * dev,u32 start,u32 end,u8 in_intr)27171 rtl8168_rx_fill(struct rtl8168_private *tp,
27172 struct net_device *dev,
27173 u32 start,
27174 u32 end,
27175 u8 in_intr)
27176 {
27177 u32 cur;
27178
27179 for (cur = start; end - cur > 0; cur++) {
27180 int ret, i = cur % NUM_RX_DESC;
27181
27182 if (tp->Rx_skbuff[i])
27183 continue;
27184
27185 ret = rtl8168_alloc_rx_skb(tp, tp->Rx_skbuff + i,
27186 tp->RxDescArray + i,
27187 tp->rx_buf_sz,
27188 in_intr);
27189 if (ret < 0)
27190 break;
27191 }
27192 return cur - start;
27193 }
27194
27195 static inline void
rtl8168_mark_as_last_descriptor(struct RxDesc * desc)27196 rtl8168_mark_as_last_descriptor(struct RxDesc *desc)
27197 {
27198 desc->opts1 |= cpu_to_le32(RingEnd);
27199 }
27200
27201 static void
rtl8168_desc_addr_fill(struct rtl8168_private * tp)27202 rtl8168_desc_addr_fill(struct rtl8168_private *tp)
27203 {
27204 if (!tp->TxPhyAddr || !tp->RxPhyAddr)
27205 return;
27206
27207 RTL_W32(tp, TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_BIT_MASK(32)));
27208 RTL_W32(tp, TxDescStartAddrHigh, ((u64) tp->TxPhyAddr >> 32));
27209 RTL_W32(tp, RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_BIT_MASK(32)));
27210 RTL_W32(tp, RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32));
27211 }
27212
27213 static void
rtl8168_tx_desc_init(struct rtl8168_private * tp)27214 rtl8168_tx_desc_init(struct rtl8168_private *tp)
27215 {
27216 int i = 0;
27217
27218 memset(tp->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc));
27219
27220 for (i = 0; i < NUM_TX_DESC; i++) {
27221 if (i == (NUM_TX_DESC - 1))
27222 tp->TxDescArray[i].opts1 = cpu_to_le32(RingEnd);
27223 }
27224 }
27225
27226 static void
rtl8168_rx_desc_offset0_init(struct rtl8168_private * tp,int own)27227 rtl8168_rx_desc_offset0_init(struct rtl8168_private *tp, int own)
27228 {
27229 int i = 0;
27230 int ownbit = 0;
27231
27232 if (tp->RxDescArray == NULL) return;
27233
27234 if (own)
27235 ownbit = DescOwn;
27236
27237 for (i = 0; i < NUM_RX_DESC; i++) {
27238 if (i == (NUM_RX_DESC - 1))
27239 tp->RxDescArray[i].opts1 = cpu_to_le32((ownbit | RingEnd) | (unsigned long)tp->rx_buf_sz);
27240 else
27241 tp->RxDescArray[i].opts1 = cpu_to_le32(ownbit | (unsigned long)tp->rx_buf_sz);
27242 }
27243 }
27244
27245 static void
rtl8168_rx_desc_init(struct rtl8168_private * tp)27246 rtl8168_rx_desc_init(struct rtl8168_private *tp)
27247 {
27248 memset(tp->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc));
27249 }
27250
27251 static int
rtl8168_init_ring(struct net_device * dev)27252 rtl8168_init_ring(struct net_device *dev)
27253 {
27254 struct rtl8168_private *tp = netdev_priv(dev);
27255
27256 rtl8168_init_ring_indexes(tp);
27257
27258 memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
27259 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *));
27260
27261 rtl8168_tx_desc_init(tp);
27262 rtl8168_rx_desc_init(tp);
27263
27264 if (rtl8168_rx_fill(tp, dev, 0, NUM_RX_DESC, 0) != NUM_RX_DESC)
27265 goto err_out;
27266
27267 rtl8168_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
27268
27269 return 0;
27270
27271 err_out:
27272 rtl8168_rx_clear(tp);
27273 return -ENOMEM;
27274 }
27275
27276 static void
rtl8168_unmap_tx_skb(struct pci_dev * pdev,struct ring_info * tx_skb,struct TxDesc * desc)27277 rtl8168_unmap_tx_skb(struct pci_dev *pdev,
27278 struct ring_info *tx_skb,
27279 struct TxDesc *desc)
27280 {
27281 unsigned int len = tx_skb->len;
27282
27283 dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, DMA_TO_DEVICE);
27284
27285 desc->opts1 = cpu_to_le32(RTK_MAGIC_DEBUG_VALUE);
27286 desc->opts2 = 0x00;
27287 desc->addr = 0x00;
27288 tx_skb->len = 0;
27289 }
27290
rtl8168_tx_clear_range(struct rtl8168_private * tp,u32 start,unsigned int n)27291 static void rtl8168_tx_clear_range(struct rtl8168_private *tp, u32 start,
27292 unsigned int n)
27293 {
27294 unsigned int i;
27295 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
27296 struct net_device *dev = tp->dev;
27297 #endif
27298
27299 for (i = 0; i < n; i++) {
27300 unsigned int entry = (start + i) % NUM_TX_DESC;
27301 struct ring_info *tx_skb = tp->tx_skb + entry;
27302 unsigned int len = tx_skb->len;
27303
27304 if (len) {
27305 struct sk_buff *skb = tx_skb->skb;
27306
27307 rtl8168_unmap_tx_skb(tp->pci_dev, tx_skb,
27308 tp->TxDescArray + entry);
27309 if (skb) {
27310 RTLDEV->stats.tx_dropped++;
27311 dev_kfree_skb_any(skb);
27312 tx_skb->skb = NULL;
27313 }
27314 }
27315 }
27316 }
27317
27318 static void
rtl8168_tx_clear(struct rtl8168_private * tp)27319 rtl8168_tx_clear(struct rtl8168_private *tp)
27320 {
27321 rtl8168_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC);
27322 tp->cur_tx = tp->dirty_tx = 0;
27323 }
27324
27325 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
rtl8168_schedule_work(struct net_device * dev,void (* task)(void *))27326 static void rtl8168_schedule_work(struct net_device *dev, void (*task)(void *))
27327 {
27328 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27329 struct rtl8168_private *tp = netdev_priv(dev);
27330
27331 INIT_WORK(&tp->task, task, dev);
27332 schedule_delayed_work(&tp->task, 4);
27333 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27334 }
27335
27336 #define rtl8168_cancel_schedule_work(a)
27337
27338 #else
rtl8168_schedule_work(struct net_device * dev,work_func_t task)27339 static void rtl8168_schedule_work(struct net_device *dev, work_func_t task)
27340 {
27341 struct rtl8168_private *tp = netdev_priv(dev);
27342
27343 INIT_DELAYED_WORK(&tp->task, task);
27344 schedule_delayed_work(&tp->task, 4);
27345 }
27346
rtl8168_cancel_schedule_work(struct net_device * dev)27347 static void rtl8168_cancel_schedule_work(struct net_device *dev)
27348 {
27349 struct rtl8168_private *tp = netdev_priv(dev);
27350 struct work_struct *work = &tp->task.work;
27351
27352 if (!work->func) return;
27353
27354 cancel_delayed_work_sync(&tp->task);
27355 }
27356 #endif
27357
27358 static void
rtl8168_wait_for_quiescence(struct net_device * dev)27359 rtl8168_wait_for_quiescence(struct net_device *dev)
27360 {
27361 struct rtl8168_private *tp = netdev_priv(dev);
27362
27363 synchronize_irq(dev->irq);
27364
27365 /* Wait for any pending NAPI task to complete */
27366 #ifdef CONFIG_R8168_NAPI
27367 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27368 RTL_NAPI_DISABLE(dev, &tp->napi);
27369 #endif
27370 #endif//CONFIG_R8168_NAPI
27371
27372 rtl8168_irq_mask_and_ack(tp);
27373
27374 #ifdef CONFIG_R8168_NAPI
27375 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27376 RTL_NAPI_ENABLE(dev, &tp->napi);
27377 #endif
27378 #endif//CONFIG_R8168_NAPI
27379 }
27380
27381 #if 0
27382 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
27383 static void rtl8168_reinit_task(void *_data)
27384 #else
27385 static void rtl8168_reinit_task(struct work_struct *work)
27386 #endif
27387 {
27388 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
27389 struct net_device *dev = _data;
27390 #else
27391 struct rtl8168_private *tp =
27392 container_of(work, struct rtl8168_private, task.work);
27393 struct net_device *dev = tp->dev;
27394 #endif
27395 int ret;
27396
27397 if (netif_running(dev)) {
27398 rtl8168_wait_for_quiescence(dev);
27399 rtl8168_close(dev);
27400 }
27401
27402 ret = rtl8168_open(dev);
27403 if (unlikely(ret < 0)) {
27404 if (unlikely(net_ratelimit())) {
27405 struct rtl8168_private *tp = netdev_priv(dev);
27406
27407 if (netif_msg_drv(tp)) {
27408 printk(PFX KERN_ERR
27409 "%s: reinit failure (status = %d)."
27410 " Rescheduling.\n", dev->name, ret);
27411 }
27412 }
27413 rtl8168_schedule_work(dev, rtl8168_reinit_task);
27414 }
27415 }
27416 #endif
27417
27418 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
rtl8168_reset_task(void * _data)27419 static void rtl8168_reset_task(void *_data)
27420 {
27421 struct net_device *dev = _data;
27422 struct rtl8168_private *tp = netdev_priv(dev);
27423 #else
27424 static void rtl8168_reset_task(struct work_struct *work)
27425 {
27426 struct rtl8168_private *tp =
27427 container_of(work, struct rtl8168_private, task.work);
27428 struct net_device *dev = tp->dev;
27429 #endif
27430 u32 budget = ~(u32)0;
27431 unsigned long flags;
27432
27433 if (!netif_running(dev))
27434 return;
27435
27436 rtl8168_wait_for_quiescence(dev);
27437
27438 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
27439 rtl8168_rx_interrupt(dev, tp, &budget);
27440 #else
27441 rtl8168_rx_interrupt(dev, tp, budget);
27442 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
27443
27444 spin_lock_irqsave(&tp->lock, flags);
27445
27446 rtl8168_tx_clear(tp);
27447
27448 if (tp->dirty_rx == tp->cur_rx) {
27449 rtl8168_rx_clear(tp);
27450 rtl8168_init_ring(dev);
27451 rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
27452 spin_unlock_irqrestore(&tp->lock, flags);
27453 } else {
27454 spin_unlock_irqrestore(&tp->lock, flags);
27455 if (unlikely(net_ratelimit())) {
27456 struct rtl8168_private *tp = netdev_priv(dev);
27457
27458 if (netif_msg_intr(tp)) {
27459 printk(PFX KERN_EMERG
27460 "%s: Rx buffers shortage\n", dev->name);
27461 }
27462 }
27463 rtl8168_schedule_work(dev, rtl8168_reset_task);
27464 }
27465 }
27466
27467 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
27468 static void
27469 rtl8168_tx_timeout(struct net_device *dev, unsigned int txqueue)
27470 #else
27471 static void
27472 rtl8168_tx_timeout(struct net_device *dev)
27473 #endif
27474 {
27475 struct rtl8168_private *tp = netdev_priv(dev);
27476 unsigned long flags;
27477
27478 spin_lock_irqsave(&tp->lock, flags);
27479 netif_stop_queue(dev);
27480 netif_carrier_off(dev);
27481 rtl8168_hw_reset(dev);
27482 spin_unlock_irqrestore(&tp->lock, flags);
27483
27484 /* Let's wait a bit while any (async) irq lands on */
27485 rtl8168_schedule_work(dev, rtl8168_reset_task);
27486 }
27487
27488 static u32
27489 rtl8168_get_txd_opts1(u32 opts1, u32 len, unsigned int entry)
27490 {
27491 u32 status = opts1 | len;
27492
27493 if (entry == NUM_TX_DESC - 1)
27494 status |= RingEnd;
27495
27496 return status;
27497 }
27498
27499 static int
27500 rtl8168_xmit_frags(struct rtl8168_private *tp,
27501 struct sk_buff *skb,
27502 const u32 *opts)
27503 {
27504 struct skb_shared_info *info = skb_shinfo(skb);
27505 unsigned int cur_frag, entry;
27506 struct TxDesc *txd = NULL;
27507 const unsigned char nr_frags = info->nr_frags;
27508
27509 entry = tp->cur_tx;
27510 for (cur_frag = 0; cur_frag < nr_frags; cur_frag++) {
27511 skb_frag_t *frag = info->frags + cur_frag;
27512 dma_addr_t mapping;
27513 u32 status, len;
27514 void *addr;
27515
27516 entry = (entry + 1) % NUM_TX_DESC;
27517
27518 txd = tp->TxDescArray + entry;
27519 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
27520 len = frag->size;
27521 addr = ((void *) page_address(frag->page)) + frag->page_offset;
27522 #else
27523 len = skb_frag_size(frag);
27524 addr = skb_frag_address(frag);
27525 #endif
27526 mapping = dma_map_single(tp_to_dev(tp), addr, len, DMA_TO_DEVICE);
27527
27528 if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) {
27529 if (unlikely(net_ratelimit()))
27530 netif_err(tp, drv, tp->dev,
27531 "Failed to map TX fragments DMA!\n");
27532 goto err_out;
27533 }
27534
27535 /* anti gcc 2.95.3 bugware (sic) */
27536 status = rtl8168_get_txd_opts1(opts[0], len, entry);
27537 if (cur_frag == (nr_frags - 1)) {
27538 tp->tx_skb[entry].skb = skb;
27539 status |= LastFrag;
27540 }
27541
27542 txd->addr = cpu_to_le64(mapping);
27543
27544 tp->tx_skb[entry].len = len;
27545
27546 txd->opts2 = cpu_to_le32(opts[1]);
27547 wmb();
27548 txd->opts1 = cpu_to_le32(status);
27549 }
27550
27551 return cur_frag;
27552
27553 err_out:
27554 rtl8168_tx_clear_range(tp, tp->cur_tx + 1, cur_frag);
27555 return -EIO;
27556 }
27557
27558 static inline
27559 __be16 get_protocol(struct sk_buff *skb)
27560 {
27561 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
27562 return vlan_get_protocol(skb);
27563 #else
27564 __be16 protocol;
27565
27566 if (skb->protocol == htons(ETH_P_8021Q))
27567 protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
27568 else
27569 protocol = skb->protocol;
27570
27571 return protocol;
27572 #endif
27573 }
27574
27575 static bool rtl8168_skb_pad(struct sk_buff *skb)
27576 {
27577 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
27578 if (skb_padto(skb, ETH_ZLEN))
27579 return false;
27580 skb_put(skb, ETH_ZLEN - skb->len);
27581 return true;
27582 #else
27583 return !eth_skb_pad(skb);
27584 #endif
27585 }
27586
27587 static inline bool
27588 rtl8168_tx_csum(struct sk_buff *skb,
27589 struct net_device *dev,
27590 u32 *opts)
27591 {
27592 struct rtl8168_private *tp = netdev_priv(dev);
27593 u32 csum_cmd = 0;
27594 u8 sw_calc_csum = FALSE;
27595
27596 if (skb->ip_summed == CHECKSUM_PARTIAL) {
27597 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
27598 const struct iphdr *ip = skb->nh.iph;
27599
27600 if (dev->features & NETIF_F_IP_CSUM) {
27601 if (ip->protocol == IPPROTO_TCP)
27602 csum_cmd = tp->tx_ip_csum_cmd | tp->tx_tcp_csum_cmd;
27603 else if (ip->protocol == IPPROTO_UDP)
27604 csum_cmd = tp->tx_ip_csum_cmd | tp->tx_udp_csum_cmd;
27605 else if (ip->protocol == IPPROTO_IP)
27606 csum_cmd = tp->tx_ip_csum_cmd;
27607 }
27608 #else
27609 u8 ip_protocol = IPPROTO_RAW;
27610
27611 switch (get_protocol(skb)) {
27612 case __constant_htons(ETH_P_IP):
27613 if (dev->features & NETIF_F_IP_CSUM) {
27614 ip_protocol = ip_hdr(skb)->protocol;
27615 csum_cmd = tp->tx_ip_csum_cmd;
27616 }
27617 break;
27618 case __constant_htons(ETH_P_IPV6):
27619 if (dev->features & NETIF_F_IPV6_CSUM) {
27620 u32 transport_offset = (u32)skb_transport_offset(skb);
27621 if (transport_offset > 0 && transport_offset <= TCPHO_MAX) {
27622 ip_protocol = ipv6_hdr(skb)->nexthdr;
27623 csum_cmd = tp->tx_ipv6_csum_cmd;
27624 csum_cmd |= transport_offset << TCPHO_SHIFT;
27625 }
27626 }
27627 break;
27628 default:
27629 if (unlikely(net_ratelimit()))
27630 dprintk("checksum_partial proto=%x!\n", skb->protocol);
27631 break;
27632 }
27633
27634 if (ip_protocol == IPPROTO_TCP)
27635 csum_cmd |= tp->tx_tcp_csum_cmd;
27636 else if (ip_protocol == IPPROTO_UDP)
27637 csum_cmd |= tp->tx_udp_csum_cmd;
27638 #endif
27639 if (csum_cmd == 0) {
27640 sw_calc_csum = TRUE;
27641 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27642 WARN_ON(1); /* we need a WARN() */
27643 #endif
27644 }
27645 }
27646
27647 if (csum_cmd != 0) {
27648 if (tp->ShortPacketSwChecksum && skb->len < ETH_ZLEN) {
27649 sw_calc_csum = TRUE;
27650 if (!rtl8168_skb_pad(skb))
27651 return false;
27652 } else {
27653 if ((tp->mcfg == CFG_METHOD_1) || (tp->mcfg == CFG_METHOD_2) || (tp->mcfg == CFG_METHOD_3))
27654 opts[0] |= csum_cmd;
27655 else
27656 opts[1] |= csum_cmd;
27657 }
27658 }
27659
27660 if (tp->UseSwPaddingShortPkt && skb->len < ETH_ZLEN)
27661 if (!rtl8168_skb_pad(skb))
27662 return false;
27663
27664 if (sw_calc_csum) {
27665 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
27666 skb_checksum_help(&skb, 0);
27667 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
27668 skb_checksum_help(skb, 0);
27669 #else
27670 skb_checksum_help(skb);
27671 #endif
27672 }
27673
27674 return true;
27675 }
27676
27677 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
27678 /* r8169_csum_workaround()
27679 * The hw limits the value the transport offset. When the offset is out of the
27680 * range, calculate the checksum by sw.
27681 */
27682 static void r8168_csum_workaround(struct rtl8168_private *tp,
27683 struct sk_buff *skb)
27684 {
27685 if (skb_shinfo(skb)->gso_size) {
27686 netdev_features_t features = tp->dev->features;
27687 struct sk_buff *segs, *nskb;
27688
27689 features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
27690 segs = skb_gso_segment(skb, features);
27691 if (IS_ERR(segs) || !segs)
27692 goto drop;
27693
27694 do {
27695 nskb = segs;
27696 segs = segs->next;
27697 nskb->next = NULL;
27698 rtl8168_start_xmit(nskb, tp->dev);
27699 } while (segs);
27700
27701 dev_consume_skb_any(skb);
27702 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
27703 if (skb_checksum_help(skb) < 0)
27704 goto drop;
27705
27706 rtl8168_start_xmit(skb, tp->dev);
27707 } else {
27708 struct net_device_stats *stats;
27709
27710 drop:
27711 stats = &tp->dev->stats;
27712 stats->tx_dropped++;
27713 dev_kfree_skb_any(skb);
27714 }
27715 }
27716
27717 /* msdn_giant_send_check()
27718 * According to the document of microsoft, the TCP Pseudo Header excludes the
27719 * packet length for IPv6 TCP large packets.
27720 */
27721 static int msdn_giant_send_check(struct sk_buff *skb)
27722 {
27723 const struct ipv6hdr *ipv6h;
27724 struct tcphdr *th;
27725 int ret;
27726
27727 ret = skb_cow_head(skb, 0);
27728 if (ret)
27729 return ret;
27730
27731 ipv6h = ipv6_hdr(skb);
27732 th = tcp_hdr(skb);
27733
27734 th->check = 0;
27735 th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0);
27736
27737 return ret;
27738 }
27739 #endif
27740
27741 static bool rtl8168_tx_slots_avail(struct rtl8168_private *tp,
27742 unsigned int nr_frags)
27743 {
27744 unsigned int slots_avail = tp->dirty_tx + NUM_TX_DESC - tp->cur_tx;
27745
27746 /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */
27747 return slots_avail > nr_frags;
27748 }
27749
27750 static netdev_tx_t
27751 rtl8168_start_xmit(struct sk_buff *skb,
27752 struct net_device *dev)
27753 {
27754 struct rtl8168_private *tp = netdev_priv(dev);
27755 unsigned int entry;
27756 struct TxDesc *txd;
27757 dma_addr_t mapping;
27758 u32 len;
27759 u32 opts[2];
27760 netdev_tx_t ret = NETDEV_TX_OK;
27761 unsigned long flags, large_send;
27762 int frags;
27763
27764 spin_lock_irqsave(&tp->lock, flags);
27765
27766 if (unlikely(!rtl8168_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) {
27767 if (netif_msg_drv(tp)) {
27768 printk(KERN_ERR
27769 "%s: BUG! Tx Ring full when queue awake!\n",
27770 dev->name);
27771 }
27772 goto err_stop;
27773 }
27774
27775 entry = tp->cur_tx % NUM_TX_DESC;
27776 txd = tp->TxDescArray + entry;
27777
27778 if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) {
27779 if (netif_msg_drv(tp)) {
27780 printk(KERN_ERR
27781 "%s: BUG! Tx Desc is own by hardware!\n",
27782 dev->name);
27783 }
27784 goto err_stop;
27785 }
27786
27787 opts[0] = DescOwn;
27788 opts[1] = rtl8168_tx_vlan_tag(tp, skb);
27789
27790 large_send = 0;
27791 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27792 if (dev->features & (NETIF_F_TSO | NETIF_F_TSO6)) {
27793 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
27794 u32 mss = skb_shinfo(skb)->tso_size;
27795 #else
27796 u32 mss = skb_shinfo(skb)->gso_size;
27797 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
27798
27799 /* TCP Segmentation Offload (or TCP Large Send) */
27800 if (mss) {
27801 if ((tp->mcfg == CFG_METHOD_1) ||
27802 (tp->mcfg == CFG_METHOD_2) ||
27803 (tp->mcfg == CFG_METHOD_3)) {
27804 opts[0] |= LargeSend | (min(mss, MSS_MAX) << 16);
27805 large_send = 1;
27806 } else {
27807 u32 transport_offset = (u32)skb_transport_offset(skb);
27808 switch (get_protocol(skb)) {
27809 case __constant_htons(ETH_P_IP):
27810 if (transport_offset <= GTTCPHO_MAX) {
27811 opts[0] |= GiantSendv4;
27812 opts[0] |= transport_offset << GTTCPHO_SHIFT;
27813 opts[1] |= min(mss, MSS_MAX) << 18;
27814 large_send = 1;
27815 }
27816 break;
27817 case __constant_htons(ETH_P_IPV6):
27818 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
27819 if (msdn_giant_send_check(skb)) {
27820 spin_unlock_irqrestore(&tp->lock, flags);
27821 r8168_csum_workaround(tp, skb);
27822 goto out;
27823 }
27824 #endif
27825 if (transport_offset <= GTTCPHO_MAX) {
27826 opts[0] |= GiantSendv6;
27827 opts[0] |= transport_offset << GTTCPHO_SHIFT;
27828 opts[1] |= min(mss, MSS_MAX) << 18;
27829 large_send = 1;
27830 }
27831 break;
27832 default:
27833 if (unlikely(net_ratelimit()))
27834 dprintk("tso proto=%x!\n", skb->protocol);
27835 break;
27836 }
27837 }
27838
27839 if (large_send == 0)
27840 goto err_dma_0;
27841 }
27842 }
27843 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
27844
27845 if (large_send == 0) {
27846 if (unlikely(!rtl8168_tx_csum(skb, dev, opts)))
27847 goto err_dma_0;
27848 }
27849
27850 frags = rtl8168_xmit_frags(tp, skb, opts);
27851 if (unlikely(frags < 0))
27852 goto err_dma_0;
27853 if (frags) {
27854 len = skb_headlen(skb);
27855 opts[0] |= FirstFrag;
27856 } else {
27857 len = skb->len;
27858
27859 tp->tx_skb[entry].skb = skb;
27860
27861 opts[0] |= FirstFrag | LastFrag;
27862 }
27863
27864 opts[0] = rtl8168_get_txd_opts1(opts[0], len, entry);
27865 mapping = dma_map_single(tp_to_dev(tp), skb->data, len, DMA_TO_DEVICE);
27866 if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) {
27867 if (unlikely(net_ratelimit()))
27868 netif_err(tp, drv, dev, "Failed to map TX DMA!\n");
27869 goto err_dma_1;
27870 }
27871 tp->tx_skb[entry].len = len;
27872 txd->addr = cpu_to_le64(mapping);
27873 txd->opts2 = cpu_to_le32(opts[1]);
27874 wmb();
27875 txd->opts1 = cpu_to_le32(opts[0]);
27876
27877 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
27878 dev->trans_start = jiffies;
27879 #else
27880 skb_tx_timestamp(skb);
27881 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
27882
27883 tp->cur_tx += frags + 1;
27884
27885 wmb();
27886
27887 RTL_W8(tp, TxPoll, NPQ); /* set polling bit */
27888
27889 if (!rtl8168_tx_slots_avail(tp, MAX_SKB_FRAGS)) {
27890 netif_stop_queue(dev);
27891 smp_rmb();
27892 if (rtl8168_tx_slots_avail(tp, MAX_SKB_FRAGS))
27893 netif_wake_queue(dev);
27894 }
27895
27896 spin_unlock_irqrestore(&tp->lock, flags);
27897 out:
27898 return ret;
27899 err_dma_1:
27900 tp->tx_skb[entry].skb = NULL;
27901 rtl8168_tx_clear_range(tp, tp->cur_tx + 1, frags);
27902 err_dma_0:
27903 RTLDEV->stats.tx_dropped++;
27904 spin_unlock_irqrestore(&tp->lock, flags);
27905 dev_kfree_skb_any(skb);
27906 ret = NETDEV_TX_OK;
27907 goto out;
27908 err_stop:
27909 netif_stop_queue(dev);
27910 ret = NETDEV_TX_BUSY;
27911 RTLDEV->stats.tx_dropped++;
27912
27913 spin_unlock_irqrestore(&tp->lock, flags);
27914 goto out;
27915 }
27916
27917 static void
27918 rtl8168_tx_interrupt(struct net_device *dev,
27919 struct rtl8168_private *tp)
27920 {
27921 unsigned int dirty_tx, tx_left;
27922
27923 assert(dev != NULL);
27924 assert(tp != NULL);
27925
27926 dirty_tx = tp->dirty_tx;
27927 smp_rmb();
27928 tx_left = tp->cur_tx - dirty_tx;
27929 tp->dynamic_aspm_packet_count += tx_left;
27930
27931 while (tx_left > 0) {
27932 unsigned int entry = dirty_tx % NUM_TX_DESC;
27933 struct ring_info *tx_skb = tp->tx_skb + entry;
27934 u32 len = tx_skb->len;
27935 u32 status;
27936
27937 rmb();
27938 status = le32_to_cpu(tp->TxDescArray[entry].opts1);
27939 if (status & DescOwn)
27940 break;
27941
27942 RTLDEV->stats.tx_bytes += len;
27943 RTLDEV->stats.tx_packets++;
27944
27945 rtl8168_unmap_tx_skb(tp->pci_dev,
27946 tx_skb,
27947 tp->TxDescArray + entry);
27948
27949 if (tx_skb->skb!=NULL) {
27950 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
27951 dev_consume_skb_any(tx_skb->skb);
27952 #else
27953 dev_kfree_skb_any(tx_skb->skb);
27954 #endif
27955 tx_skb->skb = NULL;
27956 }
27957 dirty_tx++;
27958 tx_left--;
27959 }
27960
27961 tp->dynamic_aspm_packet_count -= tx_left;
27962
27963 if (tp->dirty_tx != dirty_tx) {
27964 tp->dirty_tx = dirty_tx;
27965 smp_wmb();
27966 if (netif_queue_stopped(dev) &&
27967 (rtl8168_tx_slots_avail(tp, MAX_SKB_FRAGS))) {
27968 netif_wake_queue(dev);
27969 }
27970 smp_rmb();
27971 if (tp->cur_tx != dirty_tx)
27972 RTL_W8(tp, TxPoll, NPQ);
27973 }
27974 }
27975
27976 static inline int
27977 rtl8168_fragmented_frame(u32 status)
27978 {
27979 return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag);
27980 }
27981
27982 static inline void
27983 rtl8168_rx_csum(struct rtl8168_private *tp,
27984 struct sk_buff *skb,
27985 struct RxDesc *desc)
27986 {
27987 u32 opts1 = le32_to_cpu(desc->opts1);
27988 u32 opts2 = le32_to_cpu(desc->opts2);
27989
27990 if ((tp->mcfg == CFG_METHOD_1) ||
27991 (tp->mcfg == CFG_METHOD_2) ||
27992 (tp->mcfg == CFG_METHOD_3)) {
27993 u32 status = opts1 & RxProtoMask;
27994
27995 /* rx csum offload for RTL8168B/8111B */
27996 if (((status == RxProtoTCP) && !(opts1 & (RxTCPF | RxIPF))) ||
27997 ((status == RxProtoUDP) && !(opts1 & (RxUDPF | RxIPF))))
27998 skb->ip_summed = CHECKSUM_UNNECESSARY;
27999 else
28000 skb->ip_summed = CHECKSUM_NONE;
28001 } else {
28002 /* rx csum offload for RTL8168C/8111C and RTL8168CP/8111CP */
28003 if (((opts2 & RxV4F) && !(opts1 & RxIPF)) || (opts2 & RxV6F)) {
28004 if (((opts1 & RxTCPT) && !(opts1 & RxTCPF)) ||
28005 ((opts1 & RxUDPT) && !(opts1 & RxUDPF)))
28006 skb->ip_summed = CHECKSUM_UNNECESSARY;
28007 else
28008 skb->ip_summed = CHECKSUM_NONE;
28009 } else
28010 skb->ip_summed = CHECKSUM_NONE;
28011 }
28012 }
28013
28014 static inline int
28015 rtl8168_try_rx_copy(struct rtl8168_private *tp,
28016 struct sk_buff **sk_buff,
28017 int pkt_size,
28018 struct RxDesc *desc,
28019 int rx_buf_sz)
28020 {
28021 int ret = -1;
28022
28023 if (pkt_size < rx_copybreak) {
28024 struct sk_buff *skb;
28025
28026 skb = RTL_ALLOC_SKB_INTR(tp, pkt_size + RTK_RX_ALIGN);
28027 if (skb) {
28028 u8 *data;
28029
28030 data = sk_buff[0]->data;
28031 skb_reserve(skb, RTK_RX_ALIGN);
28032 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37)
28033 prefetch(data - RTK_RX_ALIGN);
28034 #endif
28035 eth_copy_and_sum(skb, data, pkt_size, 0);
28036 *sk_buff = skb;
28037 rtl8168_mark_to_asic(desc, rx_buf_sz);
28038 ret = 0;
28039 }
28040 }
28041 return ret;
28042 }
28043
28044 static inline void
28045 rtl8168_rx_skb(struct rtl8168_private *tp,
28046 struct sk_buff *skb)
28047 {
28048 #ifdef CONFIG_R8168_NAPI
28049 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
28050 netif_receive_skb(skb);
28051 #else
28052 napi_gro_receive(&tp->napi, skb);
28053 #endif
28054 #else
28055 netif_rx(skb);
28056 #endif
28057 }
28058
28059 static int
28060 rtl8168_rx_interrupt(struct net_device *dev,
28061 struct rtl8168_private *tp,
28062 napi_budget budget)
28063 {
28064 unsigned int cur_rx, rx_left;
28065 unsigned int delta, count = 0;
28066 unsigned int entry;
28067 struct RxDesc *desc;
28068 u32 status;
28069 u32 rx_quota;
28070
28071 assert(dev != NULL);
28072 assert(tp != NULL);
28073
28074 if (tp->RxDescArray == NULL)
28075 goto rx_out;
28076
28077 rx_quota = RTL_RX_QUOTA(budget);
28078 cur_rx = tp->cur_rx;
28079 entry = cur_rx % NUM_RX_DESC;
28080 desc = tp->RxDescArray + entry;
28081 rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx;
28082 rx_left = rtl8168_rx_quota(rx_left, (u32)rx_quota);
28083
28084 for (; rx_left > 0; rx_left--) {
28085 rmb();
28086 status = le32_to_cpu(desc->opts1);
28087 if (status & DescOwn)
28088 break;
28089 if (unlikely(status & RxRES)) {
28090 if (netif_msg_rx_err(tp)) {
28091 printk(KERN_INFO
28092 "%s: Rx ERROR. status = %08x\n",
28093 dev->name, status);
28094 }
28095
28096 RTLDEV->stats.rx_errors++;
28097
28098 if (status & (RxRWT | RxRUNT))
28099 RTLDEV->stats.rx_length_errors++;
28100 if (status & RxCRC)
28101 RTLDEV->stats.rx_crc_errors++;
28102 if (dev->features & NETIF_F_RXALL)
28103 goto process_pkt;
28104
28105 rtl8168_mark_to_asic(desc, tp->rx_buf_sz);
28106 } else {
28107 struct sk_buff *skb;
28108 int pkt_size;
28109
28110 process_pkt:
28111 if (likely(!(dev->features & NETIF_F_RXFCS)))
28112 pkt_size = (status & 0x00003fff) - 4;
28113 else
28114 pkt_size = status & 0x00003fff;
28115
28116 /*
28117 * The driver does not support incoming fragmented
28118 * frames. They are seen as a symptom of over-mtu
28119 * sized frames.
28120 */
28121 if (unlikely(rtl8168_fragmented_frame(status))) {
28122 RTLDEV->stats.rx_dropped++;
28123 RTLDEV->stats.rx_length_errors++;
28124 rtl8168_mark_to_asic(desc, tp->rx_buf_sz);
28125 continue;
28126 }
28127
28128 skb = tp->Rx_skbuff[entry];
28129
28130 dma_sync_single_for_cpu(tp_to_dev(tp),
28131 le64_to_cpu(desc->addr), tp->rx_buf_sz,
28132 DMA_FROM_DEVICE);
28133
28134 if (rtl8168_try_rx_copy(tp, &skb, pkt_size,
28135 desc, tp->rx_buf_sz)) {
28136 tp->Rx_skbuff[entry] = NULL;
28137 dma_unmap_single(tp_to_dev(tp), le64_to_cpu(desc->addr),
28138 tp->rx_buf_sz, DMA_FROM_DEVICE);
28139 } else {
28140 dma_sync_single_for_device(tp_to_dev(tp), le64_to_cpu(desc->addr),
28141 tp->rx_buf_sz, DMA_FROM_DEVICE);
28142 }
28143
28144 if (tp->cp_cmd & RxChkSum)
28145 rtl8168_rx_csum(tp, skb, desc);
28146
28147 skb->dev = dev;
28148 skb_put(skb, pkt_size);
28149 skb->protocol = eth_type_trans(skb, dev);
28150
28151 if (skb->pkt_type == PACKET_MULTICAST)
28152 RTLDEV->stats.multicast++;
28153
28154 if (rtl8168_rx_vlan_skb(tp, desc, skb) < 0)
28155 rtl8168_rx_skb(tp, skb);
28156 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
28157 dev->last_rx = jiffies;
28158 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
28159 RTLDEV->stats.rx_bytes += pkt_size;
28160 RTLDEV->stats.rx_packets++;
28161 }
28162
28163 cur_rx++;
28164 entry = cur_rx % NUM_RX_DESC;
28165 desc = tp->RxDescArray + entry;
28166 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37)
28167 prefetch(desc);
28168 #endif
28169 }
28170
28171 count = cur_rx - tp->cur_rx;
28172 tp->cur_rx = cur_rx;
28173
28174 delta = rtl8168_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, 1);
28175 if (!delta && count && netif_msg_intr(tp))
28176 printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name);
28177 tp->dirty_rx += delta;
28178
28179 tp->dynamic_aspm_packet_count += delta;
28180
28181 /*
28182 * FIXME: until there is periodic timer to try and refill the ring,
28183 * a temporary shortage may definitely kill the Rx process.
28184 * - disable the asic to try and avoid an overflow and kick it again
28185 * after refill ?
28186 * - how do others driver handle this condition (Uh oh...).
28187 */
28188 if ((tp->dirty_rx + NUM_RX_DESC == tp->cur_rx) && netif_msg_intr(tp))
28189 printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name);
28190
28191 rx_out:
28192 return count;
28193 }
28194
28195 /*
28196 *The interrupt handler does all of the Rx thread work and cleans up after
28197 *the Tx thread.
28198 */
28199 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
28200 static irqreturn_t rtl8168_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
28201 #else
28202 static irqreturn_t rtl8168_interrupt(int irq, void *dev_instance)
28203 #endif
28204 {
28205 struct net_device *dev = (struct net_device *) dev_instance;
28206 struct rtl8168_private *tp = netdev_priv(dev);
28207 int status;
28208 int handled = 0;
28209
28210 do {
28211 status = RTL_R16(tp, IntrStatus);
28212
28213 if (!(tp->features & RTL_FEATURE_MSI)) {
28214 /* hotplug/major error/no more work/shared irq */
28215 if ((status == 0xFFFF) || !status)
28216 break;
28217
28218 if (!(status & (tp->intr_mask | tp->timer_intr_mask)))
28219 break;
28220 }
28221
28222 handled = 1;
28223
28224 rtl8168_disable_hw_interrupt(tp);
28225
28226 switch (tp->mcfg) {
28227 case CFG_METHOD_9:
28228 case CFG_METHOD_10:
28229 case CFG_METHOD_11:
28230 case CFG_METHOD_12:
28231 case CFG_METHOD_13:
28232 case CFG_METHOD_14:
28233 case CFG_METHOD_15:
28234 case CFG_METHOD_16:
28235 case CFG_METHOD_17:
28236 case CFG_METHOD_18:
28237 case CFG_METHOD_19:
28238 case CFG_METHOD_20:
28239 case CFG_METHOD_21:
28240 case CFG_METHOD_22:
28241 case CFG_METHOD_23:
28242 case CFG_METHOD_24:
28243 case CFG_METHOD_25:
28244 case CFG_METHOD_26:
28245 case CFG_METHOD_27:
28246 case CFG_METHOD_28:
28247 case CFG_METHOD_29:
28248 case CFG_METHOD_30:
28249 case CFG_METHOD_31:
28250 case CFG_METHOD_32:
28251 case CFG_METHOD_33:
28252 /* RX_OVERFLOW RE-START mechanism now HW handles it automatically*/
28253 RTL_W16(tp, IntrStatus, status&~RxFIFOOver);
28254 break;
28255 default:
28256 RTL_W16(tp, IntrStatus, status);
28257 break;
28258 }
28259
28260 //Work around for rx fifo overflow
28261 if (unlikely(status & RxFIFOOver)) {
28262 if (tp->mcfg == CFG_METHOD_1) {
28263 netif_stop_queue(dev);
28264 udelay(300);
28265 rtl8168_hw_reset(dev);
28266 rtl8168_tx_clear(tp);
28267 rtl8168_rx_clear(tp);
28268 rtl8168_init_ring(dev);
28269 rtl8168_hw_config(dev);
28270 rtl8168_hw_start(dev);
28271 netif_wake_queue(dev);
28272 }
28273 }
28274
28275 #ifdef ENABLE_DASH_SUPPORT
28276 if ( tp->DASH ) {
28277 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
28278 u8 DashIntType2Status;
28279
28280 if (status & ISRIMR_DASH_INTR_CMAC_RESET)
28281 tp->CmacResetIntr = TRUE;
28282
28283 DashIntType2Status = RTL_CMAC_R8(tp, CMAC_IBISR0);
28284 if (DashIntType2Status & ISRIMR_DASH_TYPE2_ROK) {
28285 tp->RcvFwDashOkEvt = TRUE;
28286 }
28287 if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) {
28288 tp->SendFwHostOkEvt = TRUE;
28289 }
28290 if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) {
28291 tp->DashFwDisableRx = TRUE;
28292 }
28293
28294 RTL_CMAC_W8(tp, CMAC_IBISR0, DashIntType2Status);
28295 } else {
28296 if (status & ISRIMR_DP_REQSYS_OK) {
28297 tp->RcvFwReqSysOkEvt = TRUE;
28298 }
28299 if (status & ISRIMR_DP_DASH_OK) {
28300 tp->RcvFwDashOkEvt = TRUE;
28301 }
28302 if (status & ISRIMR_DP_HOST_OK) {
28303 tp->SendFwHostOkEvt = TRUE;
28304 }
28305 }
28306 }
28307 #endif
28308
28309 #ifdef CONFIG_R8168_NAPI
28310 if (status & tp->intr_mask || tp->keep_intr_cnt-- > 0) {
28311 if (status & tp->intr_mask)
28312 tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT;
28313
28314 if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &tp->napi)))
28315 __RTL_NETIF_RX_SCHEDULE(dev, &tp->napi);
28316 else if (netif_msg_intr(tp))
28317 printk(KERN_INFO "%s: interrupt %04x in poll\n",
28318 dev->name, status);
28319 } else {
28320 tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT;
28321 rtl8168_switch_to_hw_interrupt(tp);
28322 }
28323 #else
28324 if (status & tp->intr_mask || tp->keep_intr_cnt-- > 0) {
28325 u32 budget = ~(u32)0;
28326
28327 if (status & tp->intr_mask)
28328 tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT;
28329 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
28330 rtl8168_rx_interrupt(dev, tp, &budget);
28331 #else
28332 rtl8168_rx_interrupt(dev, tp, budget);
28333 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
28334 rtl8168_tx_interrupt(dev, tp);
28335
28336 #ifdef ENABLE_DASH_SUPPORT
28337 if ( tp->DASH ) {
28338 struct net_device *dev = tp->dev;
28339
28340 HandleDashInterrupt(dev);
28341 }
28342 #endif
28343
28344 rtl8168_switch_to_timer_interrupt(tp);
28345 } else {
28346 tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT;
28347 rtl8168_switch_to_hw_interrupt(tp);
28348 }
28349 #endif
28350
28351 } while (false);
28352
28353 return IRQ_RETVAL(handled);
28354 }
28355
28356 #ifdef CONFIG_R8168_NAPI
28357 static int rtl8168_poll(napi_ptr napi, napi_budget budget)
28358 {
28359 struct rtl8168_private *tp = RTL_GET_PRIV(napi, struct rtl8168_private);
28360 RTL_GET_NETDEV(tp)
28361 unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev);
28362 unsigned int work_done;
28363 unsigned long flags;
28364
28365 work_done = rtl8168_rx_interrupt(dev, tp, budget);
28366
28367 spin_lock_irqsave(&tp->lock, flags);
28368 rtl8168_tx_interrupt(dev, tp);
28369 spin_unlock_irqrestore(&tp->lock, flags);
28370
28371 RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget);
28372
28373 if (work_done < work_to_do) {
28374 #ifdef ENABLE_DASH_SUPPORT
28375 if ( tp->DASH ) {
28376 struct net_device *dev = tp->dev;
28377
28378 spin_lock_irqsave(&tp->lock, flags);
28379 HandleDashInterrupt(dev);
28380 spin_unlock_irqrestore(&tp->lock, flags);
28381 }
28382 #endif
28383
28384 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
28385 if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE;
28386 #else
28387 RTL_NETIF_RX_COMPLETE(dev, napi, work_done);
28388 #endif
28389 /*
28390 * 20040426: the barrier is not strictly required but the
28391 * behavior of the irq handler could be less predictable
28392 * without it. Btw, the lack of flush for the posted pci
28393 * write is safe - FR
28394 */
28395 smp_wmb();
28396
28397 rtl8168_switch_to_timer_interrupt(tp);
28398 }
28399
28400 return RTL_NAPI_RETURN_VALUE;
28401 }
28402 #endif//CONFIG_R8168_NAPI
28403
28404 static void rtl8168_sleep_rx_enable(struct net_device *dev)
28405 {
28406 struct rtl8168_private *tp = netdev_priv(dev);
28407
28408 if (tp->wol_enabled != WOL_ENABLED) return;
28409
28410 if ((tp->mcfg == CFG_METHOD_1) || (tp->mcfg == CFG_METHOD_2)) {
28411 RTL_W8(tp, ChipCmd, CmdReset);
28412 rtl8168_rx_desc_offset0_init(tp, 0);
28413 RTL_W8(tp, ChipCmd, CmdRxEnb);
28414 } else if (tp->mcfg == CFG_METHOD_14 || tp->mcfg == CFG_METHOD_15) {
28415 rtl8168_ephy_write(tp, 0x19, 0xFF64);
28416 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
28417 }
28418 }
28419
28420 static void rtl8168_down(struct net_device *dev)
28421 {
28422 struct rtl8168_private *tp = netdev_priv(dev);
28423 unsigned long flags;
28424
28425 rtl8168_delete_esd_timer(dev, &tp->esd_timer);
28426
28427 rtl8168_delete_link_timer(dev, &tp->link_timer);
28428
28429 #ifdef CONFIG_R8168_NAPI
28430 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
28431 RTL_NAPI_DISABLE(dev, &tp->napi);
28432 #endif
28433 #endif//CONFIG_R8168_NAPI
28434
28435 netif_stop_queue(dev);
28436
28437 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11)
28438 /* Give a racing hard_start_xmit a few cycles to complete. */
28439 synchronize_rcu(); /* FIXME: should this be synchronize_irq()? */
28440 #endif
28441
28442 spin_lock_irqsave(&tp->lock, flags);
28443
28444 netif_carrier_off(dev);
28445
28446 rtl8168_dsm(dev, DSM_IF_DOWN);
28447
28448 rtl8168_hw_reset(dev);
28449
28450 spin_unlock_irqrestore(&tp->lock, flags);
28451
28452 synchronize_irq(dev->irq);
28453
28454 spin_lock_irqsave(&tp->lock, flags);
28455
28456 rtl8168_tx_clear(tp);
28457
28458 rtl8168_rx_clear(tp);
28459
28460 spin_unlock_irqrestore(&tp->lock, flags);
28461 }
28462
28463 static int rtl8168_close(struct net_device *dev)
28464 {
28465 struct rtl8168_private *tp = netdev_priv(dev);
28466 struct pci_dev *pdev = tp->pci_dev;
28467 unsigned long flags;
28468
28469 if (tp->TxDescArray!=NULL && tp->RxDescArray!=NULL) {
28470 rtl8168_cancel_schedule_work(dev);
28471
28472 rtl8168_down(dev);
28473
28474 pci_clear_master(tp->pci_dev);
28475
28476 spin_lock_irqsave(&tp->lock, flags);
28477
28478 rtl8168_hw_d3_para(dev);
28479
28480 rtl8168_powerdown_pll(dev);
28481
28482 rtl8168_sleep_rx_enable(dev);
28483
28484 spin_unlock_irqrestore(&tp->lock, flags);
28485
28486 free_irq(dev->irq, dev);
28487
28488 dma_free_coherent(&pdev->dev, R8168_RX_RING_BYTES, tp->RxDescArray,
28489 tp->RxPhyAddr);
28490 dma_free_coherent(&pdev->dev, R8168_TX_RING_BYTES, tp->TxDescArray,
28491 tp->TxPhyAddr);
28492 tp->TxDescArray = NULL;
28493 tp->RxDescArray = NULL;
28494 } else {
28495 spin_lock_irqsave(&tp->lock, flags);
28496
28497 rtl8168_hw_d3_para(dev);
28498
28499 rtl8168_powerdown_pll(dev);
28500
28501 spin_unlock_irqrestore(&tp->lock, flags);
28502 }
28503
28504 return 0;
28505 }
28506
28507 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11)
28508 static void rtl8168_shutdown(struct pci_dev *pdev)
28509 {
28510 struct net_device *dev = pci_get_drvdata(pdev);
28511 struct rtl8168_private *tp = netdev_priv(dev);
28512
28513 if (HW_DASH_SUPPORT_DASH(tp))
28514 rtl8168_driver_stop(tp);
28515
28516 rtl8168_set_bios_setting(dev);
28517 if (s5_keep_curr_mac == 0 && tp->random_mac == 0)
28518 rtl8168_rar_set(tp, tp->org_mac_addr);
28519
28520 #ifdef ENABLE_FIBER_SUPPORT
28521 rtl8168_hw_fiber_nic_d3_para(dev);
28522 #endif //ENABLE_FIBER_SUPPORT
28523
28524 if (s5wol == 0)
28525 tp->wol_enabled = WOL_DISABLED;
28526
28527 rtl8168_close(dev);
28528 rtl8168_disable_msi(pdev, tp);
28529
28530 if (system_state == SYSTEM_POWER_OFF) {
28531 pci_clear_master(tp->pci_dev);
28532 rtl8168_sleep_rx_enable(dev);
28533 pci_wake_from_d3(pdev, tp->wol_enabled);
28534 pci_set_power_state(pdev, PCI_D3hot);
28535 }
28536 }
28537 #endif
28538
28539 /**
28540 * rtl8168_get_stats - Get rtl8168 read/write statistics
28541 * @dev: The Ethernet Device to get statistics for
28542 *
28543 * Get TX/RX statistics for rtl8168
28544 */
28545 static struct
28546 net_device_stats *rtl8168_get_stats(struct net_device *dev)
28547 {
28548 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
28549 struct rtl8168_private *tp = netdev_priv(dev);
28550 #endif
28551 if (netif_running(dev)) {
28552 // spin_lock_irqsave(&tp->lock, flags);
28553 // spin_unlock_irqrestore(&tp->lock, flags);
28554 }
28555
28556 return &RTLDEV->stats;
28557 }
28558
28559 #ifdef CONFIG_PM
28560
28561 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
28562 static int
28563 rtl8168_suspend(struct pci_dev *pdev, u32 state)
28564 #else
28565 static int
28566 rtl8168_suspend(struct pci_dev *pdev, pm_message_t state)
28567 #endif
28568 {
28569 struct net_device *dev = pci_get_drvdata(pdev);
28570 struct rtl8168_private *tp = netdev_priv(dev);
28571 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
28572 u32 pci_pm_state = pci_choose_state(pdev, state);
28573 #endif
28574 unsigned long flags;
28575
28576 if (!netif_running(dev))
28577 goto out;
28578
28579 rtl8168_cancel_schedule_work(dev);
28580
28581 rtl8168_delete_esd_timer(dev, &tp->esd_timer);
28582
28583 rtl8168_delete_link_timer(dev, &tp->link_timer);
28584
28585 netif_stop_queue(dev);
28586
28587 netif_carrier_off(dev);
28588
28589 netif_device_detach(dev);
28590
28591 spin_lock_irqsave(&tp->lock, flags);
28592
28593 rtl8168_dsm(dev, DSM_NIC_GOTO_D3);
28594
28595 rtl8168_hw_reset(dev);
28596
28597 pci_clear_master(pdev);
28598
28599 rtl8168_hw_d3_para(dev);
28600
28601 #ifdef ENABLE_FIBER_SUPPORT
28602 rtl8168_hw_fiber_nic_d3_para(dev);
28603 #endif //ENABLE_FIBER_SUPPORT
28604
28605 rtl8168_powerdown_pll(dev);
28606
28607 rtl8168_sleep_rx_enable(dev);
28608
28609 spin_unlock_irqrestore(&tp->lock, flags);
28610
28611 out:
28612 if (HW_DASH_SUPPORT_DASH(tp)) {
28613 spin_lock_irqsave(&tp->lock, flags);
28614 rtl8168_driver_stop(tp);
28615 spin_unlock_irqrestore(&tp->lock, flags);
28616 }
28617
28618 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
28619 pci_save_state(pdev, &pci_pm_state);
28620 #else
28621 pci_save_state(pdev);
28622 #endif
28623 pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled);
28624 // pci_set_power_state(pdev, pci_choose_state(pdev, state));
28625
28626 return 0;
28627 }
28628
28629 static int
28630 rtl8168_resume(struct pci_dev *pdev)
28631 {
28632 struct net_device *dev = pci_get_drvdata(pdev);
28633 struct rtl8168_private *tp = netdev_priv(dev);
28634 unsigned long flags;
28635 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
28636 u32 pci_pm_state = PCI_D0;
28637 #endif
28638
28639 pci_set_power_state(pdev, PCI_D0);
28640 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
28641 pci_restore_state(pdev, &pci_pm_state);
28642 #else
28643 pci_restore_state(pdev);
28644 #endif
28645 pci_enable_wake(pdev, PCI_D0, 0);
28646
28647 spin_lock_irqsave(&tp->lock, flags);
28648
28649 /* restore last modified mac address */
28650 rtl8168_rar_set(tp, dev->dev_addr);
28651
28652 spin_unlock_irqrestore(&tp->lock, flags);
28653
28654 if (!netif_running(dev)) {
28655 if (HW_DASH_SUPPORT_DASH(tp)) {
28656 spin_lock_irqsave(&tp->lock, flags);
28657 rtl8168_driver_start(tp);
28658 spin_unlock_irqrestore(&tp->lock, flags);
28659 }
28660 goto out;
28661 }
28662
28663 pci_set_master(pdev);
28664
28665 spin_lock_irqsave(&tp->lock, flags);
28666
28667 rtl8168_exit_oob(dev);
28668
28669 rtl8168_dsm(dev, DSM_NIC_RESUME_D3);
28670
28671 rtl8168_hw_init(dev);
28672
28673 rtl8168_powerup_pll(dev);
28674
28675 rtl8168_hw_ephy_config(dev);
28676
28677 rtl8168_hw_phy_config(dev);
28678
28679 rtl8168_hw_config(dev);
28680
28681 spin_unlock_irqrestore(&tp->lock, flags);
28682
28683 rtl8168_schedule_work(dev, rtl8168_reset_task);
28684
28685 netif_device_attach(dev);
28686
28687 mod_timer(&tp->esd_timer, jiffies + RTL8168_ESD_TIMEOUT);
28688 mod_timer(&tp->link_timer, jiffies + RTL8168_LINK_TIMEOUT);
28689 out:
28690 return 0;
28691 }
28692
28693 #endif /* CONFIG_PM */
28694
28695 static struct pci_driver rtl8168_pci_driver = {
28696 .name = MODULENAME,
28697 .id_table = rtl8168_pci_tbl,
28698 .probe = rtl8168_init_one,
28699 .remove = __devexit_p(rtl8168_remove_one),
28700 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11)
28701 .shutdown = rtl8168_shutdown,
28702 #endif
28703 #ifdef CONFIG_PM
28704 .suspend = rtl8168_suspend,
28705 .resume = rtl8168_resume,
28706 #endif
28707 };
28708
28709 static int __init
28710 rtl8168_init_module(void)
28711 {
28712 #ifdef ENABLE_R8168_PROCFS
28713 rtl8168_proc_module_init();
28714 #endif
28715 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
28716 return pci_register_driver(&rtl8168_pci_driver);
28717 #else
28718 return pci_module_init(&rtl8168_pci_driver);
28719 #endif
28720 }
28721
28722 static void __exit
28723 rtl8168_cleanup_module(void)
28724 {
28725 pci_unregister_driver(&rtl8168_pci_driver);
28726 #ifdef ENABLE_R8168_PROCFS
28727 if (rtl8168_proc) {
28728 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
28729 remove_proc_subtree(MODULENAME, init_net.proc_net);
28730 #else
28731 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
28732 remove_proc_entry(MODULENAME, init_net.proc_net);
28733 #else
28734 remove_proc_entry(MODULENAME, proc_net);
28735 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
28736 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
28737 rtl8168_proc = NULL;
28738 }
28739 #endif
28740 }
28741
28742 module_init(rtl8168_init_module);
28743 module_exit(rtl8168_cleanup_module);
28744