author | Florian Pose <fp@igh-essen.com> |
Wed, 18 Jun 2008 14:37:00 +0000 | |
changeset 1032 | 748c34ab66b6 |
parent 1011 | a0759d0dded4 |
permissions | -rw-r--r-- |
897
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* License, or (at your option) any later version. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Technology, IP and trade marks. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
* r8169.c: RealTek 8169/8168/8101 ethernet driver. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
* Copyright (c) a lot of people too. Please respect their work. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
* See MAINTAINERS file for support contact information. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#include <linux/module.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
#include <linux/moduleparam.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#include <linux/pci.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
#include <linux/netdevice.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
#include <linux/etherdevice.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
#include <linux/delay.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
#include <linux/ethtool.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
#include <linux/mii.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
#include <linux/if_vlan.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
#include <linux/crc32.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
#include <linux/in.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
#include <linux/ip.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
#include <linux/tcp.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
#include <linux/init.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
#include <linux/dma-mapping.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
#include <asm/system.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
#include <asm/io.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
#include <asm/irq.h> |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
#ifdef CONFIG_R8169_NAPI |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
#define NAPI_SUFFIX "-NAPI" |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
#else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
#define NAPI_SUFFIX "" |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
#define RTL8169_VERSION "2.2LK" NAPI_SUFFIX |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
#define MODULENAME "r8169" |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
#define PFX MODULENAME ": " |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
#include "../globals.h" |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
#include "ecdev.h" |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
#ifdef RTL8169_DEBUG |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
#define assert(expr) \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
if (!(expr)) { \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
printk( "Assertion failed! %s,%s,%s,line=%d\n", \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
#expr,__FILE__,__FUNCTION__,__LINE__); \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
#define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
#else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
#define assert(expr) do {} while (0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
#define dprintk(fmt, args...) do {} while (0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
#endif /* RTL8169_DEBUG */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
#define R8169_MSG_DEFAULT \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
(NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
#define TX_BUFFS_AVAIL(tp) \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
(tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
#ifdef CONFIG_R8169_NAPI |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
#define rtl8169_rx_skb netif_receive_skb |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
#define rtl8169_rx_quota(count, quota) min(count, quota) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
#else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
#define rtl8169_rx_skb netif_rx |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
#define rtl8169_rx_quota(count, quota) count |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
static const int max_interrupt_work = 20; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
The RTL chips use a 64 element hash table based on the Ethernet CRC. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
static const int multicast_filter_limit = 32; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
/* MAC address length */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
#define MAC_ADDR_LEN 6 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
#define RxPacketMaxSize 0x3FE8 /* 16K - 1 - ETH_HLEN - VLAN - CRC... */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
#define SafeMtu 0x1c20 /* ... actually life sucks beyond ~7k */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
#define R8169_REGS_SIZE 256 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
#define R8169_NAPI_WEIGHT 64 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
#define NUM_TX_DESC 64 /* Number of Tx descriptor registers */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
#define NUM_RX_DESC 256 /* Number of Rx descriptor registers */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
#define RX_BUF_SIZE 1536 /* Rx Buffer size */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
#define R8169_TX_RING_BYTES (NUM_TX_DESC * sizeof(struct TxDesc)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
#define R8169_RX_RING_BYTES (NUM_RX_DESC * sizeof(struct RxDesc)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
#define RTL8169_TX_TIMEOUT (6*HZ) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
#define RTL8169_PHY_TIMEOUT (10*HZ) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
/* write/read MMIO register */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
#define RTL_R8(reg) readb (ioaddr + (reg)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
#define RTL_R16(reg) readw (ioaddr + (reg)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
enum mac_version { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
RTL_GIGA_MAC_VER_01 = 0x01, // 8169 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
RTL_GIGA_MAC_VER_02 = 0x02, // 8169S |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
RTL_GIGA_MAC_VER_03 = 0x03, // 8110S |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
RTL_GIGA_MAC_VER_04 = 0x04, // 8169SB |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
RTL_GIGA_MAC_VER_05 = 0x05, // 8110SCd |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
RTL_GIGA_MAC_VER_06 = 0x06, // 8110SCe |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
RTL_GIGA_MAC_VER_11 = 0x0b, // 8168Bb |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
RTL_GIGA_MAC_VER_12 = 0x0c, // 8168Be 8168Bf |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
RTL_GIGA_MAC_VER_13 = 0x0d, // 8101Eb 8101Ec |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
RTL_GIGA_MAC_VER_14 = 0x0e, // 8101 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
RTL_GIGA_MAC_VER_15 = 0x0f // 8101 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
enum phy_version { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
RTL_GIGA_PHY_VER_C = 0x03, /* PHY Reg 0x03 bit0-3 == 0x0000 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
RTL_GIGA_PHY_VER_D = 0x04, /* PHY Reg 0x03 bit0-3 == 0x0000 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
RTL_GIGA_PHY_VER_E = 0x05, /* PHY Reg 0x03 bit0-3 == 0x0000 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
RTL_GIGA_PHY_VER_F = 0x06, /* PHY Reg 0x03 bit0-3 == 0x0001 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
RTL_GIGA_PHY_VER_G = 0x07, /* PHY Reg 0x03 bit0-3 == 0x0002 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
RTL_GIGA_PHY_VER_H = 0x08, /* PHY Reg 0x03 bit0-3 == 0x0003 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
#define _R(NAME,MAC,MASK) \ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
{ .name = NAME, .mac_version = MAC, .RxConfigMask = MASK } |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
static const struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
const char *name; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
u8 mac_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
u32 RxConfigMask; /* Clears the bits supported by this chip */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
} rtl_chip_info[] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
_R("RTL8169", RTL_GIGA_MAC_VER_01, 0xff7e1880), // 8169 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
_R("RTL8169s", RTL_GIGA_MAC_VER_02, 0xff7e1880), // 8169S |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
_R("RTL8110s", RTL_GIGA_MAC_VER_03, 0xff7e1880), // 8110S |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
_R("RTL8169sb/8110sb", RTL_GIGA_MAC_VER_04, 0xff7e1880), // 8169SB |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
_R("RTL8169sc/8110sc", RTL_GIGA_MAC_VER_05, 0xff7e1880), // 8110SCd |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
_R("RTL8169sc/8110sc", RTL_GIGA_MAC_VER_06, 0xff7e1880), // 8110SCe |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
_R("RTL8168b/8111b", RTL_GIGA_MAC_VER_11, 0xff7e1880), // PCI-E |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
_R("RTL8168b/8111b", RTL_GIGA_MAC_VER_12, 0xff7e1880), // PCI-E |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
_R("RTL8101e", RTL_GIGA_MAC_VER_13, 0xff7e1880), // PCI-E 8139 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
_R("RTL8100e", RTL_GIGA_MAC_VER_14, 0xff7e1880), // PCI-E 8139 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
_R("RTL8100e", RTL_GIGA_MAC_VER_15, 0xff7e1880) // PCI-E 8139 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
#undef _R |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
enum cfg_version { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
RTL_CFG_0 = 0x00, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
RTL_CFG_1, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
RTL_CFG_2 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
static void rtl_hw_start_8169(struct net_device *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
static void rtl_hw_start_8168(struct net_device *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
static void rtl_hw_start_8101(struct net_device *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
static struct pci_device_id rtl8169_pci_tbl[] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
{ PCI_DEVICE(0x1259, 0xc107), 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
{ PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
{ PCI_VENDOR_ID_LINKSYS, 0x1032, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
{0,}, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
static int rx_copybreak = 200; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
static int use_dac; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
static struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
u32 msg_enable; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
} debug = { -1 }; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
enum rtl_registers { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
MAC0 = 0, /* Ethernet hardware address. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
MAC4 = 4, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
MAR0 = 8, /* Multicast filter. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
CounterAddrLow = 0x10, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
CounterAddrHigh = 0x14, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
TxDescStartAddrLow = 0x20, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
TxDescStartAddrHigh = 0x24, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
TxHDescStartAddrLow = 0x28, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
TxHDescStartAddrHigh = 0x2c, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
FLASH = 0x30, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
ERSR = 0x36, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
ChipCmd = 0x37, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
TxPoll = 0x38, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
IntrMask = 0x3c, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
IntrStatus = 0x3e, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
TxConfig = 0x40, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
RxConfig = 0x44, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
RxMissed = 0x4c, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
Cfg9346 = 0x50, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
Config0 = 0x51, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
Config1 = 0x52, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
Config2 = 0x53, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
Config3 = 0x54, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
Config4 = 0x55, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
Config5 = 0x56, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
MultiIntr = 0x5c, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
PHYAR = 0x60, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
TBICSR = 0x64, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
TBI_ANAR = 0x68, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
TBI_LPAR = 0x6a, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
PHYstatus = 0x6c, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
RxMaxSize = 0xda, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
CPlusCmd = 0xe0, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
IntrMitigate = 0xe2, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
RxDescAddrLow = 0xe4, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
RxDescAddrHigh = 0xe8, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
EarlyTxThres = 0xec, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
FuncEvent = 0xf0, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
FuncEventMask = 0xf4, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
FuncPresetState = 0xf8, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
FuncForceEvent = 0xfc, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
enum rtl_register_content { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
/* InterruptStatusBits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
SYSErr = 0x8000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
PCSTimeout = 0x4000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
SWInt = 0x0100, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
TxDescUnavail = 0x0080, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
RxFIFOOver = 0x0040, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
LinkChg = 0x0020, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
RxOverflow = 0x0010, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
TxErr = 0x0008, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
TxOK = 0x0004, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
RxErr = 0x0002, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
RxOK = 0x0001, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
/* RxStatusDesc */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
RxFOVF = (1 << 23), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
RxRWT = (1 << 22), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
RxRES = (1 << 21), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
RxRUNT = (1 << 20), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
RxCRC = (1 << 19), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
/* ChipCmdBits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
CmdReset = 0x10, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
CmdRxEnb = 0x08, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
CmdTxEnb = 0x04, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
RxBufEmpty = 0x01, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
/* TXPoll register p.5 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
HPQ = 0x80, /* Poll cmd on the high prio queue */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
NPQ = 0x40, /* Poll cmd on the low prio queue */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
FSWInt = 0x01, /* Forced software interrupt */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
/* Cfg9346Bits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
Cfg9346_Lock = 0x00, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
Cfg9346_Unlock = 0xc0, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
/* rx_mode_bits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
AcceptErr = 0x20, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
AcceptRunt = 0x10, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
AcceptBroadcast = 0x08, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
AcceptMulticast = 0x04, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
AcceptMyPhys = 0x02, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
AcceptAllPhys = 0x01, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
/* RxConfigBits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
RxCfgFIFOShift = 13, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
RxCfgDMAShift = 8, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
/* TxConfigBits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
TxInterFrameGapShift = 24, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
/* Config1 register p.24 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
PMEnable = (1 << 0), /* Power Management Enable */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
/* Config2 register p. 25 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
PCI_Clock_66MHz = 0x01, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
PCI_Clock_33MHz = 0x00, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
/* Config3 register p.25 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
/* Config5 register p.27 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
BWF = (1 << 6), /* Accept Broadcast wakeup frame */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
MWF = (1 << 5), /* Accept Multicast wakeup frame */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
UWF = (1 << 4), /* Accept Unicast wakeup frame */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
LanWake = (1 << 1), /* LanWake enable/disable */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
/* TBICSR p.28 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
TBIReset = 0x80000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
TBILoopback = 0x40000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
TBINwEnable = 0x20000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
TBINwRestart = 0x10000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
TBILinkOk = 0x02000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
TBINwComplete = 0x01000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
/* CPlusCmd p.31 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
PktCntrDisable = (1 << 7), // 8168 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
RxVlan = (1 << 6), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
RxChkSum = (1 << 5), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
PCIDAC = (1 << 4), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
PCIMulRW = (1 << 3), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
INTT_0 = 0x0000, // 8168 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
INTT_1 = 0x0001, // 8168 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
INTT_2 = 0x0002, // 8168 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
INTT_3 = 0x0003, // 8168 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
/* rtl8169_PHYstatus */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
TBI_Enable = 0x80, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
TxFlowCtrl = 0x40, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
RxFlowCtrl = 0x20, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
_1000bpsF = 0x10, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
_100bps = 0x08, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
_10bps = 0x04, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
LinkStatus = 0x02, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
FullDup = 0x01, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
/* _TBICSRBit */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
TBILinkOK = 0x02000000, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
/* DumpCounterCommand */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
CounterDump = 0x8, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
enum desc_status_bit { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
DescOwn = (1 << 31), /* Descriptor is owned by NIC */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
RingEnd = (1 << 30), /* End of descriptor ring */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
FirstFrag = (1 << 29), /* First segment of a packet */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
LastFrag = (1 << 28), /* Final segment of a packet */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
/* Tx private */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
MSSShift = 16, /* MSS value position */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
MSSMask = 0xfff, /* MSS value + LargeSend bit: 12 bits */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
IPCS = (1 << 18), /* Calculate IP checksum */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
UDPCS = (1 << 17), /* Calculate UDP/IP checksum */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
TCPCS = (1 << 16), /* Calculate TCP/IP checksum */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
TxVlanTag = (1 << 17), /* Add VLAN tag */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
/* Rx private */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
PID1 = (1 << 18), /* Protocol ID bit 1/2 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
PID0 = (1 << 17), /* Protocol ID bit 2/2 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
#define RxProtoUDP (PID1) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
#define RxProtoTCP (PID0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
#define RxProtoIP (PID1 | PID0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
#define RxProtoMask RxProtoIP |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
IPFail = (1 << 16), /* IP checksum failed */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
UDPFail = (1 << 15), /* UDP/IP checksum failed */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
TCPFail = (1 << 14), /* TCP/IP checksum failed */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
RxVlanTag = (1 << 16), /* VLAN tag available */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
#define RsvdMask 0x3fffc000 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
struct TxDesc { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
__le32 opts1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
__le32 opts2; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
__le64 addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
struct RxDesc { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
__le32 opts1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
__le32 opts2; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
__le64 addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
struct ring_info { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
struct sk_buff *skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
u32 len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
u8 __pad[sizeof(void *) - sizeof(u32)]; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
struct rtl8169_private { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
void __iomem *mmio_addr; /* memory map physical address */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
struct pci_dev *pci_dev; /* Index of PCI device */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
struct net_device *dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
struct net_device_stats stats; /* statistics of net device */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
spinlock_t lock; /* spin lock flag */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
u32 msg_enable; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
int chipset; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
int mac_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
int phy_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
u32 dirty_rx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
u32 dirty_tx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
dma_addr_t TxPhyAddr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
dma_addr_t RxPhyAddr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
struct sk_buff *Rx_skbuff[NUM_RX_DESC]; /* Rx data buffers */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
struct ring_info tx_skb[NUM_TX_DESC]; /* Tx data buffers */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
unsigned align; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
unsigned rx_buf_sz; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
struct timer_list timer; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
u16 cp_cmd; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
u16 intr_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
u16 napi_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
u16 intr_mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
int phy_auto_nego_reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
int phy_1000_ctrl_reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
#ifdef CONFIG_R8169_VLAN |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
struct vlan_group *vlgrp; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
int (*set_speed)(struct net_device *, u8 autoneg, u16 speed, u8 duplex); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
void (*get_settings)(struct net_device *, struct ethtool_cmd *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
void (*phy_reset_enable)(void __iomem *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
void (*hw_start)(struct net_device *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
unsigned int (*phy_reset_pending)(void __iomem *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
unsigned int (*link_ok)(void __iomem *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
struct delayed_work task; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
unsigned wol_enabled : 1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
ec_device_t *ecdev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet/EtherCAT driver"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
module_param(rx_copybreak, int, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
module_param(use_dac, int, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
module_param_named(debug, debug.msg_enable, int, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
MODULE_LICENSE("GPL"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
MODULE_VERSION(RTL8169_VERSION); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
void ec_poll(struct net_device *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
static int rtl8169_open(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
static int rtl8169_init_ring(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
static void rtl_hw_start(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
static int rtl8169_close(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
static void rtl_set_rx_mode(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
static void rtl8169_tx_timeout(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
static struct net_device_stats *rtl8169_get_stats(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
void __iomem *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
static void rtl8169_down(struct net_device *dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
static void rtl8169_rx_clear(struct rtl8169_private *tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
#ifdef CONFIG_R8169_NAPI |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
static int rtl8169_poll(struct net_device *dev, int *budget); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
static const unsigned int rtl8169_rx_config = |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
(RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0xFF) << 16 | value); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
for (i = 20; i > 0; i--) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
* Check if the RTL8169 has completed writing to the specified |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
* MII register. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
if (!(RTL_R32(PHYAR) & 0x80000000)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
udelay(25); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
static int mdio_read(void __iomem *ioaddr, int reg_addr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
int i, value = -1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
RTL_W32(PHYAR, 0x0 | (reg_addr & 0xFF) << 16); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
for (i = 20; i > 0; i--) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
* Check if the RTL8169 has completed retrieving data from |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
* the specified MII register. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
if (RTL_R32(PHYAR) & 0x80000000) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
value = (int) (RTL_R32(PHYAR) & 0xFFFF); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
udelay(25); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
return value; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
RTL_W16(IntrMask, 0x0000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
RTL_W16(IntrStatus, 0xffff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
static void rtl8169_asic_down(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
RTL_W8(ChipCmd, 0x00); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
rtl8169_irq_mask_and_ack(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
RTL_R16(CPlusCmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
static unsigned int rtl8169_tbi_reset_pending(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
return RTL_R32(TBICSR) & TBIReset; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
static unsigned int rtl8169_xmii_reset_pending(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
return mdio_read(ioaddr, MII_BMCR) & BMCR_RESET; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
static unsigned int rtl8169_tbi_link_ok(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
return RTL_R32(TBICSR) & TBILinkOk; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
static unsigned int rtl8169_xmii_link_ok(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
return RTL_R8(PHYstatus) & LinkStatus; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
static void rtl8169_tbi_reset_enable(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
RTL_W32(TBICSR, RTL_R32(TBICSR) | TBIReset); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
static void rtl8169_xmii_reset_enable(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
unsigned int val; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
val = mdio_read(ioaddr, MII_BMCR) | BMCR_RESET; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
mdio_write(ioaddr, MII_BMCR, val & 0xffff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
static void rtl8169_check_link_status(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
if (tp->link_ok(ioaddr)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
if(tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
ecdev_set_link(tp->ecdev, 1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
netif_carrier_on(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
if (netif_msg_ifup(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
printk(KERN_INFO PFX "%s: link up\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
if(tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
ecdev_set_link(tp->ecdev, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
if (netif_msg_ifdown(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
printk(KERN_INFO PFX "%s: link down\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
netif_carrier_off(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
static void rtl8169_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
u8 options; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
wol->wolopts = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
wol->supported = WAKE_ANY; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
spin_lock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
options = RTL_R8(Config1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
if (!(options & PMEnable)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
goto out_unlock; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
options = RTL_R8(Config3); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
if (options & LinkUp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
wol->wolopts |= WAKE_PHY; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
if (options & MagicPacket) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
wol->wolopts |= WAKE_MAGIC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
options = RTL_R8(Config5); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
if (options & UWF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
wol->wolopts |= WAKE_UCAST; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
if (options & BWF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
wol->wolopts |= WAKE_BCAST; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
if (options & MWF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
wol->wolopts |= WAKE_MCAST; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
out_unlock: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
spin_unlock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
static struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
u32 opt; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
u16 reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
u8 mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
} cfg[] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
{ WAKE_ANY, Config1, PMEnable }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
{ WAKE_PHY, Config3, LinkUp }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
{ WAKE_MAGIC, Config3, MagicPacket }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
{ WAKE_UCAST, Config5, UWF }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
{ WAKE_BCAST, Config5, BWF }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
{ WAKE_MCAST, Config5, MWF }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
{ WAKE_ANY, Config5, LanWake } |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
spin_lock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
RTL_W8(Cfg9346, Cfg9346_Unlock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
for (i = 0; i < ARRAY_SIZE(cfg); i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
u8 options = RTL_R8(cfg[i].reg) & ~cfg[i].mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
if (wol->wolopts & cfg[i].opt) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
options |= cfg[i].mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
RTL_W8(cfg[i].reg, options); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
RTL_W8(Cfg9346, Cfg9346_Lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
tp->wol_enabled = (wol->wolopts) ? 1 : 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
spin_unlock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
static void rtl8169_get_drvinfo(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
struct ethtool_drvinfo *info) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
strcpy(info->driver, MODULENAME); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
strcpy(info->version, RTL8169_VERSION); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
strcpy(info->bus_info, pci_name(tp->pci_dev)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
static int rtl8169_get_regs_len(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
return R8169_REGS_SIZE; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
static int rtl8169_set_speed_tbi(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
u8 autoneg, u16 speed, u8 duplex) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
int ret = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
u32 reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
reg = RTL_R32(TBICSR); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
if ((autoneg == AUTONEG_DISABLE) && (speed == SPEED_1000) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
(duplex == DUPLEX_FULL)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
RTL_W32(TBICSR, reg & ~(TBINwEnable | TBINwRestart)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
} else if (autoneg == AUTONEG_ENABLE) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
RTL_W32(TBICSR, reg | TBINwEnable | TBINwRestart); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
if (netif_msg_link(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
printk(KERN_WARNING "%s: " |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
"incorrect speed setting refused in TBI mode\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
ret = -EOPNOTSUPP; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
return ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
static int rtl8169_set_speed_xmii(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
u8 autoneg, u16 speed, u8 duplex) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
int auto_nego, giga_ctrl; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
auto_nego = mdio_read(ioaddr, MII_ADVERTISE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
ADVERTISE_100HALF | ADVERTISE_100FULL); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
giga_ctrl = mdio_read(ioaddr, MII_CTRL1000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
if (autoneg == AUTONEG_ENABLE) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
auto_nego |= (ADVERTISE_10HALF | ADVERTISE_10FULL | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
ADVERTISE_100HALF | ADVERTISE_100FULL); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
giga_ctrl |= ADVERTISE_1000FULL | ADVERTISE_1000HALF; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
if (speed == SPEED_10) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
auto_nego |= ADVERTISE_10HALF | ADVERTISE_10FULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
else if (speed == SPEED_100) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
auto_nego |= ADVERTISE_100HALF | ADVERTISE_100FULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
else if (speed == SPEED_1000) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
giga_ctrl |= ADVERTISE_1000FULL | ADVERTISE_1000HALF; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
if (duplex == DUPLEX_HALF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
auto_nego &= ~(ADVERTISE_10FULL | ADVERTISE_100FULL); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
if (duplex == DUPLEX_FULL) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_100HALF); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
/* This tweak comes straight from Realtek's driver. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
if ((speed == SPEED_100) && (duplex == DUPLEX_HALF) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
(tp->mac_version == RTL_GIGA_MAC_VER_13)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
auto_nego = ADVERTISE_100HALF | ADVERTISE_CSMA; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
/* The 8100e/8101e do Fast Ethernet only. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
if ((tp->mac_version == RTL_GIGA_MAC_VER_13) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
(tp->mac_version == RTL_GIGA_MAC_VER_14) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
(tp->mac_version == RTL_GIGA_MAC_VER_15)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
if ((giga_ctrl & (ADVERTISE_1000FULL | ADVERTISE_1000HALF)) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
netif_msg_link(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
printk(KERN_INFO "%s: PHY does not support 1000Mbps.\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
if (tp->mac_version == RTL_GIGA_MAC_VER_12) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
/* Vendor specific (0x1f) and reserved (0x0e) MII registers. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
mdio_write(ioaddr, 0x1f, 0x0000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
mdio_write(ioaddr, 0x0e, 0x0000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
tp->phy_auto_nego_reg = auto_nego; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
tp->phy_1000_ctrl_reg = giga_ctrl; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
mdio_write(ioaddr, MII_ADVERTISE, auto_nego); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
mdio_write(ioaddr, MII_CTRL1000, giga_ctrl); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
mdio_write(ioaddr, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
static int rtl8169_set_speed(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
u8 autoneg, u16 speed, u8 duplex) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
int ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
ret = tp->set_speed(dev, autoneg, speed, duplex); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
if (netif_running(dev) && (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
return ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
int ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
ret = rtl8169_set_speed(dev, cmd->autoneg, cmd->speed, cmd->duplex); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
return ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
static u32 rtl8169_get_rx_csum(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
return tp->cp_cmd & RxChkSum; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
static int rtl8169_set_rx_csum(struct net_device *dev, u32 data) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
if (data) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
tp->cp_cmd |= RxChkSum; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
tp->cp_cmd &= ~RxChkSum; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
RTL_W16(CPlusCmd, tp->cp_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
RTL_R16(CPlusCmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
#ifdef CONFIG_R8169_VLAN |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
struct sk_buff *skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
return (tp->vlgrp && vlan_tx_tag_present(skb)) ? |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
static void rtl8169_vlan_rx_register(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
struct vlan_group *grp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
tp->vlgrp = grp; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
if (tp->vlgrp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
tp->cp_cmd |= RxVlan; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
tp->cp_cmd &= ~RxVlan; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
RTL_W16(CPlusCmd, tp->cp_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
RTL_R16(CPlusCmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
struct sk_buff *skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
u32 opts2 = le32_to_cpu(desc->opts2); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
int ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
if (tp->vlgrp && (opts2 & RxVlanTag)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
rtl8169_rx_hwaccel_skb(skb, tp->vlgrp, swab16(opts2 & 0xffff)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
ret = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
} else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
ret = -1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
desc->opts2 = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
return ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
#else /* !CONFIG_R8169_VLAN */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
struct sk_buff *skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
struct sk_buff *skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
return -1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
static void rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
u32 status; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
cmd->supported = |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | SUPPORTED_FIBRE; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
cmd->port = PORT_FIBRE; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
cmd->transceiver = XCVR_INTERNAL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
status = RTL_R32(TBICSR); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
cmd->advertising = (status & TBINwEnable) ? ADVERTISED_Autoneg : 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
cmd->autoneg = !!(status & TBINwEnable); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
cmd->speed = SPEED_1000; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
cmd->duplex = DUPLEX_FULL; /* Always set */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
static void rtl8169_gset_xmii(struct net_device *dev, struct ethtool_cmd *cmd) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
u8 status; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
cmd->supported = SUPPORTED_10baseT_Half | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
SUPPORTED_10baseT_Full | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
SUPPORTED_100baseT_Half | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
SUPPORTED_100baseT_Full | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
SUPPORTED_1000baseT_Full | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
SUPPORTED_Autoneg | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
SUPPORTED_TP; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
cmd->autoneg = 1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
cmd->advertising = ADVERTISED_TP | ADVERTISED_Autoneg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
if (tp->phy_auto_nego_reg & ADVERTISE_10HALF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
cmd->advertising |= ADVERTISED_10baseT_Half; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
if (tp->phy_auto_nego_reg & ADVERTISE_10FULL) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
cmd->advertising |= ADVERTISED_10baseT_Full; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
if (tp->phy_auto_nego_reg & ADVERTISE_100HALF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
cmd->advertising |= ADVERTISED_100baseT_Half; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
if (tp->phy_auto_nego_reg & ADVERTISE_100FULL) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
cmd->advertising |= ADVERTISED_100baseT_Full; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
if (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
cmd->advertising |= ADVERTISED_1000baseT_Full; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
status = RTL_R8(PHYstatus); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
if (status & _1000bpsF) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
cmd->speed = SPEED_1000; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
else if (status & _100bps) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
cmd->speed = SPEED_100; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
else if (status & _10bps) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
cmd->speed = SPEED_10; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
if (status & TxFlowCtrl) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
cmd->advertising |= ADVERTISED_Asym_Pause; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
if (status & RxFlowCtrl) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
cmd->advertising |= ADVERTISED_Pause; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
cmd->duplex = ((status & _1000bpsF) || (status & FullDup)) ? |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
DUPLEX_FULL : DUPLEX_HALF; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
static int rtl8169_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
tp->get_settings(dev, cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
void *p) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
if (regs->len > R8169_REGS_SIZE) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
regs->len = R8169_REGS_SIZE; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
memcpy_fromio(p, tp->mmio_addr, regs->len); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
static u32 rtl8169_get_msglevel(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
return tp->msg_enable; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
static void rtl8169_set_msglevel(struct net_device *dev, u32 value) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
tp->msg_enable = value; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
static const char rtl8169_gstrings[][ETH_GSTRING_LEN] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
"tx_packets", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
"rx_packets", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
"tx_errors", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
"rx_errors", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
"rx_missed", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
"align_errors", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
"tx_single_collisions", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
"tx_multi_collisions", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
"unicast", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
"broadcast", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
"multicast", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
"tx_aborted", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
"tx_underrun", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
struct rtl8169_counters { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
u64 tx_packets; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
u64 rx_packets; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
u64 tx_errors; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
u32 rx_errors; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
u16 rx_missed; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
u16 align_errors; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
u32 tx_one_collision; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
u32 tx_multi_collision; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
u64 rx_unicast; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
u64 rx_broadcast; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
u32 rx_multicast; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
u16 tx_aborted; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
u16 tx_underun; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
static int rtl8169_get_stats_count(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
return ARRAY_SIZE(rtl8169_gstrings); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
static void rtl8169_get_ethtool_stats(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
struct ethtool_stats *stats, u64 *data) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
struct rtl8169_counters *counters; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
dma_addr_t paddr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
u32 cmd; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
ASSERT_RTNL(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
if (!counters) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
RTL_W32(CounterAddrHigh, (u64)paddr >> 32); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
cmd = (u64)paddr & DMA_32BIT_MASK; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
RTL_W32(CounterAddrLow, cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
RTL_W32(CounterAddrLow, cmd | CounterDump); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
while (RTL_R32(CounterAddrLow) & CounterDump) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
if (msleep_interruptible(1)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
RTL_W32(CounterAddrLow, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
RTL_W32(CounterAddrHigh, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
data[0] = le64_to_cpu(counters->tx_packets); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
data[1] = le64_to_cpu(counters->rx_packets); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
data[2] = le64_to_cpu(counters->tx_errors); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
data[3] = le32_to_cpu(counters->rx_errors); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
data[4] = le16_to_cpu(counters->rx_missed); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
data[5] = le16_to_cpu(counters->align_errors); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
data[6] = le32_to_cpu(counters->tx_one_collision); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
data[7] = le32_to_cpu(counters->tx_multi_collision); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
data[8] = le64_to_cpu(counters->rx_unicast); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
data[9] = le64_to_cpu(counters->rx_broadcast); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
data[10] = le32_to_cpu(counters->rx_multicast); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
data[11] = le16_to_cpu(counters->tx_aborted); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
data[12] = le16_to_cpu(counters->tx_underun); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
switch(stringset) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
case ETH_SS_STATS: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
static const struct ethtool_ops rtl8169_ethtool_ops = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
.get_drvinfo = rtl8169_get_drvinfo, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
.get_regs_len = rtl8169_get_regs_len, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
.get_link = ethtool_op_get_link, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
.get_settings = rtl8169_get_settings, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
.set_settings = rtl8169_set_settings, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
.get_msglevel = rtl8169_get_msglevel, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
.set_msglevel = rtl8169_set_msglevel, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
.get_rx_csum = rtl8169_get_rx_csum, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
.set_rx_csum = rtl8169_set_rx_csum, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
.get_tx_csum = ethtool_op_get_tx_csum, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
.set_tx_csum = ethtool_op_set_tx_csum, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
.get_sg = ethtool_op_get_sg, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
.set_sg = ethtool_op_set_sg, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
.get_tso = ethtool_op_get_tso, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
.set_tso = ethtool_op_set_tso, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
.get_regs = rtl8169_get_regs, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
.get_wol = rtl8169_get_wol, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
.set_wol = rtl8169_set_wol, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
.get_strings = rtl8169_get_strings, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
.get_stats_count = rtl8169_get_stats_count, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
.get_ethtool_stats = rtl8169_get_ethtool_stats, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
int bitnum, int bitval) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
int val; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
val = mdio_read(ioaddr, reg); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
val = (bitval == 1) ? |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
val | (bitval << bitnum) : val & ~(0x0001 << bitnum); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
mdio_write(ioaddr, reg, val & 0xffff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
static void rtl8169_get_mac_version(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
* The driver currently handles the 8168Bf and the 8168Be identically |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
* but they can be identified more specifically through the test below |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
* if needed: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
* (RTL_R32(TxConfig) & 0x700000) == 0x500000 ? 8168Bf : 8168Be |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
* Same thing for the 8101Eb and the 8101Ec: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
* (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
const struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
u32 mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
int mac_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
} mac_info[] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
{ 0x38800000, RTL_GIGA_MAC_VER_15 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
{ 0x38000000, RTL_GIGA_MAC_VER_12 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
{ 0x34000000, RTL_GIGA_MAC_VER_13 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
{ 0x30800000, RTL_GIGA_MAC_VER_14 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
{ 0x30000000, RTL_GIGA_MAC_VER_11 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
{ 0x98000000, RTL_GIGA_MAC_VER_06 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
{ 0x18000000, RTL_GIGA_MAC_VER_05 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
{ 0x10000000, RTL_GIGA_MAC_VER_04 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
{ 0x04000000, RTL_GIGA_MAC_VER_03 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
{ 0x00800000, RTL_GIGA_MAC_VER_02 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
{ 0x00000000, RTL_GIGA_MAC_VER_01 } /* Catch-all */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
}, *p = mac_info; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
u32 reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
reg = RTL_R32(TxConfig) & 0xfc800000; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
while ((reg & p->mask) != p->mask) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
p++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
tp->mac_version = p->mac_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
static void rtl8169_print_mac_version(struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
dprintk("mac_version = 0x%02x\n", tp->mac_version); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
static void rtl8169_get_phy_version(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
const struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
u16 mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
u16 set; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
int phy_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
} phy_info[] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
{ 0x000f, 0x0002, RTL_GIGA_PHY_VER_G }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
{ 0x000f, 0x0001, RTL_GIGA_PHY_VER_F }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
{ 0x000f, 0x0000, RTL_GIGA_PHY_VER_E }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
{ 0x0000, 0x0000, RTL_GIGA_PHY_VER_D } /* Catch-all */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
}, *p = phy_info; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
u16 reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
reg = mdio_read(ioaddr, MII_PHYSID2) & 0xffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
while ((reg & p->mask) != p->set) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
p++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
tp->phy_version = p->phy_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
static void rtl8169_print_phy_version(struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
int version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
char *msg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
u32 reg; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
} phy_print[] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
{ RTL_GIGA_PHY_VER_G, "RTL_GIGA_PHY_VER_G", 0x0002 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
{ RTL_GIGA_PHY_VER_F, "RTL_GIGA_PHY_VER_F", 0x0001 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
{ RTL_GIGA_PHY_VER_E, "RTL_GIGA_PHY_VER_E", 0x0000 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
{ RTL_GIGA_PHY_VER_D, "RTL_GIGA_PHY_VER_D", 0x0000 }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
{ 0, NULL, 0x0000 } |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
}, *p; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
for (p = phy_print; p->msg; p++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
if (tp->phy_version == p->version) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
dprintk("phy_version == %s (%04x)\n", p->msg, p->reg); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
dprintk("phy_version == Unknown\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
static void rtl8169_hw_phy_config(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
u16 regs[5]; /* Beware of bit-sign propagation */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
} phy_magic[5] = { { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
{ 0x0000, //w 4 15 12 0 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
0x00a1, //w 3 15 0 00a1 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
0x0008, //w 2 15 0 0008 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
0x1020, //w 1 15 0 1020 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
0x1000 } },{ //w 0 15 0 1000 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
{ 0x7000, //w 4 15 12 7 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
0xff41, //w 3 15 0 ff41 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
0xde60, //w 2 15 0 de60 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
0x0140, //w 1 15 0 0140 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
0x0077 } },{ //w 0 15 0 0077 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
{ 0xa000, //w 4 15 12 a |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
0xdf01, //w 3 15 0 df01 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
0xdf20, //w 2 15 0 df20 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
0xff95, //w 1 15 0 ff95 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
0xfa00 } },{ //w 0 15 0 fa00 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
{ 0xb000, //w 4 15 12 b |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
0xff41, //w 3 15 0 ff41 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
0xde20, //w 2 15 0 de20 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
0x0140, //w 1 15 0 0140 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
0x00bb } },{ //w 0 15 0 00bb |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
{ 0xf000, //w 4 15 12 f |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
0xdf01, //w 3 15 0 df01 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
0xdf20, //w 2 15 0 df20 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
0xff95, //w 1 15 0 ff95 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
0xbf00 } //w 0 15 0 bf00 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
}, *p = phy_magic; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
rtl8169_print_mac_version(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
rtl8169_print_phy_version(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
if (tp->mac_version <= RTL_GIGA_MAC_VER_01) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
if (tp->phy_version >= RTL_GIGA_PHY_VER_H) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
dprintk("MAC version != 0 && PHY version == 0 or 1\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
dprintk("Do final_reg2.cfg\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
/* Shazam ! */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
if (tp->mac_version == RTL_GIGA_MAC_VER_04) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
mdio_write(ioaddr, 31, 0x0002); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
mdio_write(ioaddr, 1, 0x90d0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
mdio_write(ioaddr, 31, 0x0000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
if ((tp->mac_version != RTL_GIGA_MAC_VER_02) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
(tp->mac_version != RTL_GIGA_MAC_VER_03)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
mdio_write(ioaddr, 31, 0x0001); //w 31 2 0 1 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
mdio_write(ioaddr, 21, 0x1000); //w 21 15 0 1000 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
mdio_write(ioaddr, 24, 0x65c7); //w 24 15 0 65c7 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 0); //w 4 11 11 0 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
for (i = 0; i < ARRAY_SIZE(phy_magic); i++, p++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
int val, pos = 4; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
val = (mdio_read(ioaddr, pos) & 0x0fff) | (p->regs[0] & 0xffff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
mdio_write(ioaddr, pos, val); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
while (--pos >= 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
mdio_write(ioaddr, pos, p->regs[4 - pos] & 0xffff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 1); //w 4 11 11 1 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 0); //w 4 11 11 0 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
mdio_write(ioaddr, 31, 0x0000); //w 31 2 0 0 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
static void rtl8169_phy_timer(unsigned long __opaque) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
struct net_device *dev = (struct net_device *)__opaque; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
struct timer_list *timer = &tp->timer; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
unsigned long timeout = RTL8169_PHY_TIMEOUT; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
assert(tp->mac_version > RTL_GIGA_MAC_VER_01); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
assert(tp->phy_version < RTL_GIGA_PHY_VER_H); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
spin_lock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
if (tp->phy_reset_pending(ioaddr)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
* A busy loop could burn quite a few cycles on nowadays CPU. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
* Let's delay the execution of the timer for a few ticks. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
timeout = HZ/10; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
goto out_mod_timer; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
if (tp->link_ok(ioaddr)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
goto out_unlock; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
if (netif_msg_link(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
printk(KERN_WARNING "%s: PHY reset until link up\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
tp->phy_reset_enable(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
out_mod_timer: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
mod_timer(timer, jiffies + timeout); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
out_unlock: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
spin_unlock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
static inline void rtl8169_delete_timer(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
struct timer_list *timer = &tp->timer; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
if ((tp->mac_version <= RTL_GIGA_MAC_VER_01) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
(tp->phy_version >= RTL_GIGA_PHY_VER_H)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
del_timer_sync(timer); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
static inline void rtl8169_request_timer(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
struct timer_list *timer = &tp->timer; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
if ((tp->mac_version <= RTL_GIGA_MAC_VER_01) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
(tp->phy_version >= RTL_GIGA_PHY_VER_H)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
* Polling 'interrupt' - used by things like netconsole to send skbs |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
* without having to re-enable interrupts. It's not called while |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
* the interrupt routine is executing. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
static void rtl8169_netpoll(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
disable_irq(pdev->irq); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
rtl8169_interrupt(pdev->irq, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
enable_irq(pdev->irq); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
iounmap(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
pci_release_regions(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
pci_disable_device(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
free_netdev(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
static void rtl8169_phy_reset(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
tp->phy_reset_enable(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
for (i = 0; i < 100; i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
if (!tp->phy_reset_pending(ioaddr)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
return; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
msleep(1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
if (netif_msg_link(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
printk(KERN_ERR "%s: PHY reset failed.\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
rtl8169_hw_phy_config(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
RTL_W8(0x82, 0x01); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
pci_write_config_byte(tp->pci_dev, PCI_LATENCY_TIMER, 0x40); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
if (tp->mac_version <= RTL_GIGA_MAC_VER_06) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
pci_write_config_byte(tp->pci_dev, PCI_CACHE_LINE_SIZE, 0x08); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
if (tp->mac_version == RTL_GIGA_MAC_VER_02) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
RTL_W8(0x82, 0x01); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
dprintk("Set PHY Reg 0x0bh = 0x00h\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
mdio_write(ioaddr, 0x0b, 0x0000); //w 0x0b 15 0 0 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
rtl8169_phy_reset(dev, tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
* rtl8169_set_speed_xmii takes good care of the Fast Ethernet |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
* only 8101. Don't panic. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
u32 high; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
u32 low; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
low = addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
high = addr[4] | (addr[5] << 8); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
spin_lock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
RTL_W8(Cfg9346, Cfg9346_Unlock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
RTL_W32(MAC0, low); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
RTL_W32(MAC4, high); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
RTL_W8(Cfg9346, Cfg9346_Lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
spin_unlock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
static int rtl_set_mac_address(struct net_device *dev, void *p) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
struct sockaddr *addr = p; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
if (!is_valid_ether_addr(addr->sa_data)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
return -EADDRNOTAVAIL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
rtl_rar_set(tp, dev->dev_addr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
struct mii_ioctl_data *data = if_mii(ifr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
if (!netif_running(dev)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
return -ENODEV; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
switch (cmd) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
case SIOCGMIIPHY: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
data->phy_id = 32; /* Internal PHY */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
case SIOCGMIIREG: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
data->val_out = mdio_read(tp->mmio_addr, data->reg_num & 0x1f); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
case SIOCSMIIREG: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
if (!capable(CAP_NET_ADMIN)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
return -EPERM; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
mdio_write(tp->mmio_addr, data->reg_num & 0x1f, data->val_in); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
return -EOPNOTSUPP; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
static const struct rtl_cfg_info { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
void (*hw_start)(struct net_device *); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
unsigned int region; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
unsigned int align; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
u16 intr_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
u16 napi_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
} rtl_cfg_infos [] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
[RTL_CFG_0] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
.hw_start = rtl_hw_start_8169, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
.region = 1, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
.align = 0, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
.intr_event = SYSErr | LinkChg | RxOverflow | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
RxFIFOOver | TxErr | TxOK | RxOK | RxErr, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
.napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
}, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
[RTL_CFG_1] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
.hw_start = rtl_hw_start_8168, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
.region = 2, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
.align = 8, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
.intr_event = SYSErr | LinkChg | RxOverflow | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
TxErr | TxOK | RxOK | RxErr, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
.napi_event = TxErr | TxOK | RxOK | RxOverflow |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
}, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
[RTL_CFG_2] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
.hw_start = rtl_hw_start_8101, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
.region = 2, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
.align = 8, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
.intr_event = SYSErr | LinkChg | RxOverflow | PCSTimeout | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
RxFIFOOver | TxErr | TxOK | RxOK | RxErr, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
.napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
static int __devinit |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
const unsigned int region = cfg->region; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
struct rtl8169_private *tp; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
struct net_device *dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
void __iomem *ioaddr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
int rc; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
if (netif_msg_drv(&debug)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
MODULENAME, RTL8169_VERSION); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
dev = alloc_etherdev(sizeof (*tp)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
if (!dev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
if (netif_msg_drv(&debug)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
dev_err(&pdev->dev, "unable to alloc new ethernet\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
rc = -ENOMEM; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
SET_MODULE_OWNER(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
SET_NETDEV_DEV(dev, &pdev->dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
tp->dev = dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
/* enable device (incl. PCI PM wakeup and hotplug setup) */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
rc = pci_enable_device(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
if (rc < 0) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
if (netif_msg_probe(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
dev_err(&pdev->dev, "enable failure\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
goto err_out_free_dev_1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
rc = pci_set_mwi(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
if (rc < 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
goto err_out_disable_2; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
/* make sure PCI base addr 1 is MMIO */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
if (netif_msg_probe(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
dev_err(&pdev->dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
"region #%d not an MMIO resource, aborting\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
region); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
rc = -ENODEV; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
goto err_out_mwi_3; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
/* check for weird/broken PCI region reporting */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
if (pci_resource_len(pdev, region) < R8169_REGS_SIZE) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
if (netif_msg_probe(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
dev_err(&pdev->dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
"Invalid PCI region size(s), aborting\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
rc = -ENODEV; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
goto err_out_mwi_3; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
rc = pci_request_regions(pdev, MODULENAME); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
if (rc < 0) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
if (netif_msg_probe(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
dev_err(&pdev->dev, "could not request regions.\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
goto err_out_mwi_3; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
tp->cp_cmd = PCIMulRW | RxChkSum; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
if ((sizeof(dma_addr_t) > 4) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
!pci_set_dma_mask(pdev, DMA_64BIT_MASK) && use_dac) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
tp->cp_cmd |= PCIDAC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
dev->features |= NETIF_F_HIGHDMA; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
if (rc < 0) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
if (netif_msg_probe(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
dev_err(&pdev->dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
"DMA configuration failed.\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
goto err_out_free_res_4; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
pci_set_master(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
/* ioremap MMIO region */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
if (!ioaddr) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
if (netif_msg_probe(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
dev_err(&pdev->dev, "cannot remap MMIO, aborting\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
rc = -EIO; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
goto err_out_free_res_4; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
/* Unneeded ? Don't mess with Mrs. Murphy. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
rtl8169_irq_mask_and_ack(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
/* Soft reset the chip. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
RTL_W8(ChipCmd, CmdReset); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
/* Check that the chip has finished the reset. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
for (i = 0; i < 100; i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
if ((RTL_R8(ChipCmd) & CmdReset) == 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
msleep_interruptible(1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
/* Identify chip attached to board */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
rtl8169_get_mac_version(tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
rtl8169_get_phy_version(tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
rtl8169_print_mac_version(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
rtl8169_print_phy_version(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
if (tp->mac_version == rtl_chip_info[i].mac_version) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
if (i < 0) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
/* Unknown chip: assume array element #0, original RTL-8169 */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
if (netif_msg_probe(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
dev_printk(KERN_DEBUG, &pdev->dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
"unknown chip version, assuming %s\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
rtl_chip_info[0].name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
i++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
tp->chipset = i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
RTL_W8(Cfg9346, Cfg9346_Unlock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
RTL_W8(Config1, RTL_R8(Config1) | PMEnable); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
RTL_W8(Config5, RTL_R8(Config5) & PMEStatus); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
RTL_W8(Cfg9346, Cfg9346_Lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
if (RTL_R8(PHYstatus) & TBI_Enable) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
tp->set_speed = rtl8169_set_speed_tbi; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
tp->get_settings = rtl8169_gset_tbi; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
tp->phy_reset_enable = rtl8169_tbi_reset_enable; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
tp->phy_reset_pending = rtl8169_tbi_reset_pending; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
tp->link_ok = rtl8169_tbi_link_ok; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
tp->phy_1000_ctrl_reg = ADVERTISE_1000FULL; /* Implied by TBI */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
tp->set_speed = rtl8169_set_speed_xmii; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
tp->get_settings = rtl8169_gset_xmii; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
tp->phy_reset_enable = rtl8169_xmii_reset_enable; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
tp->phy_reset_pending = rtl8169_xmii_reset_pending; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
tp->link_ok = rtl8169_xmii_link_ok; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
dev->do_ioctl = rtl8169_ioctl; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
/* Get MAC address. FIXME: read EEPROM */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
for (i = 0; i < MAC_ADDR_LEN; i++) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
dev->dev_addr[i] = RTL_R8(MAC0 + i); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
dev->open = rtl8169_open; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
dev->hard_start_xmit = rtl8169_start_xmit; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
dev->get_stats = rtl8169_get_stats; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
dev->stop = rtl8169_close; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
dev->tx_timeout = rtl8169_tx_timeout; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
dev->set_multicast_list = rtl_set_rx_mode; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
dev->watchdog_timeo = RTL8169_TX_TIMEOUT; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
dev->irq = pdev->irq; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
dev->base_addr = (unsigned long) ioaddr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
dev->change_mtu = rtl8169_change_mtu; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
dev->set_mac_address = rtl_set_mac_address; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
#ifdef CONFIG_R8169_NAPI |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
dev->poll = rtl8169_poll; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
dev->weight = R8169_NAPI_WEIGHT; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
#ifdef CONFIG_R8169_VLAN |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
dev->vlan_rx_register = rtl8169_vlan_rx_register; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
dev->poll_controller = rtl8169_netpoll; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
tp->intr_mask = 0xffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
tp->pci_dev = pdev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
tp->mmio_addr = ioaddr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
tp->align = cfg->align; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
tp->hw_start = cfg->hw_start; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
tp->intr_event = cfg->intr_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
tp->napi_event = cfg->napi_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
init_timer(&tp->timer); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
tp->timer.data = (unsigned long) dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
tp->timer.function = rtl8169_phy_timer; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
spin_lock_init(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
// offer device to EtherCAT master module |
1011 | 1736 |
tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE); |
897
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
printk(KERN_INFO "about to register device named %s (%p)...\n", dev->name, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
i = register_netdev (dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
if (i) goto err_out_unmap_5; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
pci_set_drvdata(pdev, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
if (netif_msg_probe(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
u32 xid = RTL_R32(TxConfig) & 0x7cf0f8ff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
printk(KERN_INFO "%s: %s at 0x%lx, " |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
"%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
"XID %08x IRQ %d\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
dev->name, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
rtl_chip_info[tp->chipset].name, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
dev->base_addr, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
dev->dev_addr[0], dev->dev_addr[1], |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
dev->dev_addr[2], dev->dev_addr[3], |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
dev->dev_addr[4], dev->dev_addr[5], xid, dev->irq); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
rtl8169_init_phy(dev, tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
if (tp->ecdev && ecdev_open(tp->ecdev)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
ecdev_withdraw(tp->ecdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
goto err_out_unmap_5; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
return rc; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
err_out_unmap_5: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
iounmap(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
err_out_free_res_4: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
pci_release_regions(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
err_out_mwi_3: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
pci_clear_mwi(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
err_out_disable_2: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
pci_disable_device(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
err_out_free_dev_1: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
free_netdev(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
static void __devexit rtl8169_remove_one(struct pci_dev *pdev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
struct net_device *dev = pci_get_drvdata(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
flush_scheduled_work(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
if (tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
ecdev_close(tp->ecdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
ecdev_withdraw(tp->ecdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
unregister_netdev (dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
rtl8169_release_board(pdev, dev, tp->mmio_addr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
pci_set_drvdata(pdev, NULL); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
unsigned int mtu = dev->mtu; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
static int rtl8169_open(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
int retval = -ENOMEM; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
rtl8169_set_rxbufsize(tp, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
* Rx and Tx desscriptors needs 256 bytes alignment. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
* pci_alloc_consistent provides more. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
&tp->TxPhyAddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
if (!tp->TxDescArray) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
&tp->RxPhyAddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
if (!tp->RxDescArray) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
goto err_free_tx_0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
retval = rtl8169_init_ring(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
if (retval < 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
goto err_free_rx_1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
INIT_DELAYED_WORK(&tp->task, NULL); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
smp_mb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
retval = request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
dev->name, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
if (retval < 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
goto err_release_ring_2; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
rtl_hw_start(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
rtl8169_request_timer(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
rtl8169_check_link_status(dev, tp, tp->mmio_addr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
return retval; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
err_release_ring_2: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
rtl8169_rx_clear(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
err_free_rx_1: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
tp->RxPhyAddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
err_free_tx_0: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
tp->TxPhyAddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
static void rtl8169_hw_reset(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
/* Disable interrupts */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
rtl8169_irq_mask_and_ack(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
/* Reset the chipset */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
RTL_W8(ChipCmd, CmdReset); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
/* PCI commit */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
RTL_R8(ChipCmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
static void rtl_set_rx_tx_config_registers(struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
u32 cfg = rtl8169_rx_config; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
cfg |= (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
RTL_W32(RxConfig, cfg); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
/* Set DMA burst size and Interframe Gap Time */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
RTL_W32(TxConfig, (TX_DMA_BURST << TxDMAShift) | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
(InterFrameGap << TxInterFrameGapShift)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
static void rtl_hw_start(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
/* Soft reset the chip. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
RTL_W8(ChipCmd, CmdReset); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
/* Check that the chip has finished the reset. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
for (i = 0; i < 100; i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
if ((RTL_R8(ChipCmd) & CmdReset) == 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
msleep_interruptible(1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
tp->hw_start(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
netif_start_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
void ec_poll(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
rtl8169_interrupt(0, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
static void rtl_set_rx_tx_desc_registers(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
* Magic spell: some iop3xx ARM board needs the TxDescAddrHigh |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
* register to be written before TxDescAddrLow to work. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
* Switching from MMIO to I/O access fixes the issue as well. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr) >> 32); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr) & DMA_32BIT_MASK); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr) >> 32); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr) & DMA_32BIT_MASK); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
static u16 rtl_rw_cpluscmd(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
u16 cmd; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
cmd = RTL_R16(CPlusCmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
RTL_W16(CPlusCmd, cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
return cmd; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
static void rtl_set_rx_max_size(void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
/* Low hurts. Let's disable the filtering. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
RTL_W16(RxMaxSize, 16383); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
struct { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
u32 mac_version; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
u32 clk; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
u32 val; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
} cfg2_info [] = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
{ RTL_GIGA_MAC_VER_05, PCI_Clock_33MHz, 0x000fff00 }, // 8110SCd |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
{ RTL_GIGA_MAC_VER_05, PCI_Clock_66MHz, 0x000fffff }, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
{ RTL_GIGA_MAC_VER_06, PCI_Clock_33MHz, 0x00ffff00 }, // 8110SCe |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
{ RTL_GIGA_MAC_VER_06, PCI_Clock_66MHz, 0x00ffffff } |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
}, *p = cfg2_info; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
u32 clk; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
clk = RTL_R8(Config2) & PCI_Clock_66MHz; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
if ((p->mac_version == mac_version) && (p->clk == clk)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
RTL_W32(0x7c, p->val); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
static void rtl_hw_start_8169(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
if (tp->mac_version == RTL_GIGA_MAC_VER_05) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | PCIMulRW); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
RTL_W8(Cfg9346, Cfg9346_Unlock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
if ((tp->mac_version == RTL_GIGA_MAC_VER_01) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
(tp->mac_version == RTL_GIGA_MAC_VER_02) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
(tp->mac_version == RTL_GIGA_MAC_VER_03) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
(tp->mac_version == RTL_GIGA_MAC_VER_04)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
RTL_W8(EarlyTxThres, EarlyTxThld); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
rtl_set_rx_max_size(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
rtl_set_rx_tx_config_registers(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
if ((tp->mac_version == RTL_GIGA_MAC_VER_02) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
(tp->mac_version == RTL_GIGA_MAC_VER_03)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
dprintk(KERN_INFO PFX "Set MAC Reg C+CR Offset 0xE0. " |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
"Bit-3 and bit-14 MUST be 1\n"); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
tp->cp_cmd |= (1 << 14); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
RTL_W16(CPlusCmd, tp->cp_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
rtl8169_set_magic_reg(ioaddr, tp->mac_version); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
* Undocumented corner. Supposedly: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
* (TxTimer << 12) | (TxPackets << 8) | (RxTimer << 4) | RxPackets |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
RTL_W16(IntrMitigate, 0x0000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
rtl_set_rx_tx_desc_registers(tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
RTL_W8(Cfg9346, Cfg9346_Lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
/* Initially a 10 us delay. Turned it into a PCI commit. - FR */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
RTL_R8(IntrMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
RTL_W32(RxMissed, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
rtl_set_rx_mode(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
/* no early-rx interrupts */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
/* Enable all known interrupts by setting the interrupt mask. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
RTL_W16(IntrMask, tp->intr_event); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
static void rtl_hw_start_8168(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
u8 ctl; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
RTL_W8(Cfg9346, Cfg9346_Unlock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
RTL_W8(EarlyTxThres, EarlyTxThld); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
rtl_set_rx_max_size(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
rtl_set_rx_tx_config_registers(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
tp->cp_cmd |= RTL_R16(CPlusCmd) | PktCntrDisable | INTT_1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
RTL_W16(CPlusCmd, tp->cp_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
/* Tx performance tweak. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
pci_read_config_byte(pdev, 0x69, &ctl); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
ctl = (ctl & ~0x70) | 0x50; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
pci_write_config_byte(pdev, 0x69, ctl); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
RTL_W16(IntrMitigate, 0x5151); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
/* Work around for RxFIFO overflow. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
if (tp->mac_version == RTL_GIGA_MAC_VER_11) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
tp->intr_event |= RxFIFOOver | PCSTimeout; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
tp->intr_event &= ~RxOverflow; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
rtl_set_rx_tx_desc_registers(tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
RTL_W8(Cfg9346, Cfg9346_Lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
RTL_R8(IntrMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
RTL_W32(RxMissed, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
rtl_set_rx_mode(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
RTL_W16(IntrMask, tp->intr_event); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
static void rtl_hw_start_8101(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
if (tp->mac_version == RTL_GIGA_MAC_VER_13) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
pci_write_config_word(pdev, 0x68, 0x00); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
pci_write_config_word(pdev, 0x69, 0x08); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
RTL_W8(Cfg9346, Cfg9346_Unlock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
RTL_W8(EarlyTxThres, EarlyTxThld); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
rtl_set_rx_max_size(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
RTL_W16(CPlusCmd, tp->cp_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
RTL_W16(IntrMitigate, 0x0000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
rtl_set_rx_tx_desc_registers(tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
rtl_set_rx_tx_config_registers(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
RTL_W8(Cfg9346, Cfg9346_Lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
RTL_R8(IntrMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
RTL_W32(RxMissed, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
rtl_set_rx_mode(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xf000); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
RTL_W16(IntrMask, tp->intr_event); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
int ret = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
if (new_mtu < ETH_ZLEN || new_mtu > SafeMtu) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
return -EINVAL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
dev->mtu = new_mtu; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
if (!netif_running(dev)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
rtl8169_down(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
rtl8169_set_rxbufsize(tp, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
ret = rtl8169_init_ring(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
if (ret < 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
netif_poll_enable(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
rtl_hw_start(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
rtl8169_request_timer(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
return ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
desc->addr = 0x0badbadbadbadbadull; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
static void rtl8169_free_rx_skb(struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
struct sk_buff **sk_buff, struct RxDesc *desc) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
PCI_DMA_FROMDEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
dev_kfree_skb(*sk_buff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
*sk_buff = NULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
rtl8169_make_unusable_by_asic(desc); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
static inline void rtl8169_mark_to_asic(struct RxDesc *desc, u32 rx_buf_sz) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
u32 eor = le32_to_cpu(desc->opts1) & RingEnd; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
desc->opts1 = cpu_to_le32(DescOwn | eor | rx_buf_sz); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
u32 rx_buf_sz) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
desc->addr = cpu_to_le64(mapping); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
wmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
rtl8169_mark_to_asic(desc, rx_buf_sz); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
struct RxDesc *desc, int rx_buf_sz, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
unsigned int align) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
struct sk_buff *skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
dma_addr_t mapping; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
unsigned int pad; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
pad = align ? align : NET_IP_ALIGN; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
skb = netdev_alloc_skb(dev, rx_buf_sz + pad); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
if (!skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
goto err_out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
mapping = pci_map_single(pdev, skb->data, rx_buf_sz, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
PCI_DMA_FROMDEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
rtl8169_map_to_asic(desc, mapping, rx_buf_sz); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
return skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
err_out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
rtl8169_make_unusable_by_asic(desc); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
static void rtl8169_rx_clear(struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
for (i = 0; i < NUM_RX_DESC; i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
if (tp->Rx_skbuff[i]) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
rtl8169_free_rx_skb(tp, tp->Rx_skbuff + i, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
tp->RxDescArray + i); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
u32 start, u32 end) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
u32 cur; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
for (cur = start; end - cur != 0; cur++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
struct sk_buff *skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
unsigned int i = cur % NUM_RX_DESC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
WARN_ON((s32)(end - cur) < 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
if (tp->Rx_skbuff[i]) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
continue; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
tp->RxDescArray + i, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
tp->rx_buf_sz, tp->align); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
if (!skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
tp->Rx_skbuff[i] = skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
return cur - start; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
desc->opts1 |= cpu_to_le32(RingEnd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
static void rtl8169_init_ring_indexes(struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
tp->dirty_tx = tp->dirty_rx = tp->cur_tx = tp->cur_rx = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
static int rtl8169_init_ring(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
rtl8169_init_ring_indexes(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
goto err_out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
err_out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
rtl8169_rx_clear(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
return -ENOMEM; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
struct TxDesc *desc) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
unsigned int len = tx_skb->len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
desc->opts1 = 0x00; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
desc->opts2 = 0x00; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
desc->addr = 0x00; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
tx_skb->len = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
static void rtl8169_tx_clear(struct rtl8169_private *tp) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
for (i = tp->dirty_tx; i < tp->dirty_tx + NUM_TX_DESC; i++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
unsigned int entry = i % NUM_TX_DESC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
struct ring_info *tx_skb = tp->tx_skb + entry; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
unsigned int len = tx_skb->len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
if (len) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
struct sk_buff *skb = tx_skb->skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
rtl8169_unmap_tx_skb(tp->pci_dev, tx_skb, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
tp->TxDescArray + entry); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
if (skb) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
dev_kfree_skb(skb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
tx_skb->skb = NULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
tp->stats.tx_dropped++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
tp->cur_tx = tp->dirty_tx = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
static void rtl8169_schedule_work(struct net_device *dev, work_func_t task) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
PREPARE_DELAYED_WORK(&tp->task, task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
schedule_delayed_work(&tp->task, 4); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
static void rtl8169_wait_for_quiescence(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
synchronize_irq(dev->irq); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
/* Wait for any pending NAPI task to complete */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
netif_poll_disable(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
rtl8169_irq_mask_and_ack(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
netif_poll_enable(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
static void rtl8169_reinit_task(struct work_struct *work) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
struct rtl8169_private *tp = |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
container_of(work, struct rtl8169_private, task.work); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
struct net_device *dev = tp->dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
int ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
rtnl_lock(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
if (!netif_running(dev)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
goto out_unlock; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
rtl8169_wait_for_quiescence(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
rtl8169_close(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
ret = rtl8169_open(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
if (unlikely(ret < 0)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
if (net_ratelimit() && netif_msg_drv(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
printk(PFX KERN_ERR "%s: reinit failure (status = %d)." |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
" Rescheduling.\n", dev->name, ret); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
rtl8169_schedule_work(dev, rtl8169_reinit_task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
out_unlock: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
rtnl_unlock(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
static void rtl8169_reset_task(struct work_struct *work) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
struct rtl8169_private *tp = |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
container_of(work, struct rtl8169_private, task.work); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
struct net_device *dev = tp->dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
rtnl_lock(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
if (!netif_running(dev)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
goto out_unlock; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
rtl8169_wait_for_quiescence(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
rtl8169_rx_interrupt(dev, tp, tp->mmio_addr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
rtl8169_tx_clear(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
if (tp->dirty_rx == tp->cur_rx) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
rtl8169_init_ring_indexes(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
rtl_hw_start(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
netif_wake_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
if (net_ratelimit() && netif_msg_intr(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
printk(PFX KERN_EMERG "%s: Rx buffers shortage\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
rtl8169_schedule_work(dev, rtl8169_reset_task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
out_unlock: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
rtnl_unlock(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
static void rtl8169_tx_timeout(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
rtl8169_hw_reset(tp->mmio_addr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
/* Let's wait a bit while any (async) irq lands on */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
rtl8169_schedule_work(dev, rtl8169_reset_task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
u32 opts1) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
struct skb_shared_info *info = skb_shinfo(skb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
unsigned int cur_frag, entry; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
struct TxDesc * uninitialized_var(txd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
entry = tp->cur_tx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
for (cur_frag = 0; cur_frag < info->nr_frags; cur_frag++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
skb_frag_t *frag = info->frags + cur_frag; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
dma_addr_t mapping; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
u32 status, len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
void *addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
entry = (entry + 1) % NUM_TX_DESC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
txd = tp->TxDescArray + entry; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
len = frag->size; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
addr = ((void *) page_address(frag->page)) + frag->page_offset; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
/* anti gcc 2.95.3 bugware (sic) */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
txd->opts1 = cpu_to_le32(status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
txd->addr = cpu_to_le64(mapping); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
tp->tx_skb[entry].len = len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
if (cur_frag) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
tp->tx_skb[entry].skb = skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
txd->opts1 |= cpu_to_le32(LastFrag); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
return cur_frag; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
if (dev->features & NETIF_F_TSO) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
u32 mss = skb_shinfo(skb)->gso_size; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
if (mss) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
return LargeSend | ((mss & MSSMask) << MSSShift); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
if (skb->ip_summed == CHECKSUM_PARTIAL) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
const struct iphdr *ip = ip_hdr(skb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
if (ip->protocol == IPPROTO_TCP) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
return IPCS | TCPCS; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
else if (ip->protocol == IPPROTO_UDP) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
return IPCS | UDPCS; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
WARN_ON(1); /* we need a WARN() */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
unsigned int frags, entry = tp->cur_tx % NUM_TX_DESC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
struct TxDesc *txd = tp->TxDescArray + entry; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
dma_addr_t mapping; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
u32 status, len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
u32 opts1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
int ret = NETDEV_TX_OK; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
if (netif_msg_drv(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
printk(KERN_ERR |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
"%s: BUG! Tx Ring full when queue awake!\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
goto err_stop; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
goto err_stop; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
opts1 = DescOwn | rtl8169_tso_csum(skb, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
frags = rtl8169_xmit_frags(tp, skb, opts1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
if (frags) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
len = skb_headlen(skb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
opts1 |= FirstFrag; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
len = skb->len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
if (unlikely(len < ETH_ZLEN)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
if (skb_padto(skb, ETH_ZLEN)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
goto err_update_stats; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
len = ETH_ZLEN; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
opts1 |= FirstFrag | LastFrag; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
tp->tx_skb[entry].skb = skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
tp->tx_skb[entry].len = len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
txd->addr = cpu_to_le64(mapping); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
txd->opts2 = cpu_to_le32(rtl8169_tx_vlan_tag(tp, skb)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
wmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
/* anti gcc 2.95.3 bugware (sic) */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
txd->opts1 = cpu_to_le32(status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
dev->trans_start = jiffies; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
tp->cur_tx += frags + 1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
smp_wmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
RTL_W8(TxPoll, NPQ); /* set polling bit */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
netif_stop_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
smp_rmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
netif_wake_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
return ret; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
err_stop: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
netif_stop_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
ret = NETDEV_TX_BUSY; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
err_update_stats: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
tp->stats.tx_dropped++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
static void rtl8169_pcierr_interrupt(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
u16 pci_status, pci_cmd; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
pci_read_config_word(pdev, PCI_STATUS, &pci_status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
if (netif_msg_intr(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
printk(KERN_ERR |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
"%s: PCI error (cmd = 0x%04x, status = 0x%04x).\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
dev->name, pci_cmd, pci_status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
* The recovery sequence below admits a very elaborated explanation: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
* - it seems to work; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
* - I did not see what else could be done; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
* - it makes iop3xx happy. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
* Feel free to adjust to your needs. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
if (pdev->broken_parity_status) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
pci_cmd &= ~PCI_COMMAND_PARITY; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
pci_cmd |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
pci_write_config_word(pdev, PCI_STATUS, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
pci_status & (PCI_STATUS_DETECTED_PARITY | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_REC_MASTER_ABORT | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_SIG_TARGET_ABORT)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
/* The infamous DAC f*ckup only happens at boot time */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
if ((tp->cp_cmd & PCIDAC) && !tp->dirty_rx && !tp->cur_rx) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
if (netif_msg_intr(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
printk(KERN_INFO "%s: disabling PCI DAC.\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
tp->cp_cmd &= ~PCIDAC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
RTL_W16(CPlusCmd, tp->cp_cmd); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
dev->features &= ~NETIF_F_HIGHDMA; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
rtl8169_hw_reset(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
rtl8169_schedule_work(dev, rtl8169_reinit_task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
static void rtl8169_tx_interrupt(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
unsigned int dirty_tx, tx_left; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
dirty_tx = tp->dirty_tx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
smp_rmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
tx_left = tp->cur_tx - dirty_tx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
while (tx_left > 0) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
unsigned int entry = dirty_tx % NUM_TX_DESC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
struct ring_info *tx_skb = tp->tx_skb + entry; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
u32 len = tx_skb->len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
u32 status; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
rmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
status = le32_to_cpu(tp->TxDescArray[entry].opts1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
if (status & DescOwn) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
tp->stats.tx_bytes += len; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
tp->stats.tx_packets++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
rtl8169_unmap_tx_skb(tp->pci_dev, tx_skb, tp->TxDescArray + entry); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
if (status & LastFrag) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
dev_kfree_skb_irq(tx_skb->skb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
tx_skb->skb = NULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
dirty_tx++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
tx_left--; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
if (tp->dirty_tx != dirty_tx) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
tp->dirty_tx = dirty_tx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
smp_wmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
if (netif_queue_stopped(dev) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
(TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
netif_wake_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
* 8168 hack: TxPoll requests are lost when the Tx packets are |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
* too close. Let's kick an extra TxPoll request when a burst |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
* of start_xmit activity is detected (if it is not detected, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
* it is slow enough). -- FR |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
smp_rmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
if (tp->cur_tx != dirty_tx) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
RTL_W8(TxPoll, NPQ); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
static inline int rtl8169_fragmented_frame(u32 status) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
u32 opts1 = le32_to_cpu(desc->opts1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
u32 status = opts1 & RxProtoMask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
((status == RxProtoUDP) && !(opts1 & UDPFail)) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
((status == RxProtoIP) && !(opts1 & IPFail))) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
skb->ip_summed = CHECKSUM_UNNECESSARY; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
skb->ip_summed = CHECKSUM_NONE; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
struct rtl8169_private *tp, int pkt_size, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
dma_addr_t addr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
struct sk_buff *skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
bool done = false; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
if (pkt_size >= rx_copybreak) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
skb = netdev_alloc_skb(tp->dev, pkt_size + NET_IP_ALIGN); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
if (!skb) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
PCI_DMA_FROMDEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
skb_reserve(skb, NET_IP_ALIGN); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
*sk_buff = skb; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
done = true; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
return done; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
static int rtl8169_rx_interrupt(struct net_device *dev, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
struct rtl8169_private *tp, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
void __iomem *ioaddr) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
unsigned int cur_rx, rx_left; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
unsigned int delta, count; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
cur_rx = tp->cur_rx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
rx_left = rtl8169_rx_quota(rx_left, (u32) dev->quota); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
for (; rx_left > 0; rx_left--, cur_rx++) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
unsigned int entry = cur_rx % NUM_RX_DESC; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
struct RxDesc *desc = tp->RxDescArray + entry; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
u32 status; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
rmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
status = le32_to_cpu(desc->opts1); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
if (status & DescOwn) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
if (unlikely(status & RxRES)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
if (netif_msg_rx_err(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
printk(KERN_INFO |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
"%s: Rx ERROR. status = %08x\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
dev->name, status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
tp->stats.rx_errors++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
if (status & (RxRWT | RxRUNT)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
tp->stats.rx_length_errors++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
if (status & RxCRC) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
tp->stats.rx_crc_errors++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
if (status & RxFOVF) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
rtl8169_schedule_work(dev, rtl8169_reset_task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
tp->stats.rx_fifo_errors++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
struct sk_buff *skb = tp->Rx_skbuff[entry]; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
dma_addr_t addr = le64_to_cpu(desc->addr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
int pkt_size = (status & 0x00001FFF) - 4; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
* The driver does not support incoming fragmented |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
* frames. They are seen as a symptom of over-mtu |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
* sized frames. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
if (unlikely(rtl8169_fragmented_frame(status))) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
tp->stats.rx_dropped++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
tp->stats.rx_length_errors++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
continue; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
rtl8169_rx_csum(skb, desc); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
pci_dma_sync_single_for_device(pdev, addr, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
pkt_size, PCI_DMA_FROMDEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
pci_unmap_single(pdev, addr, pkt_size, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
PCI_DMA_FROMDEVICE); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
tp->Rx_skbuff[entry] = NULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
if (tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
ecdev_receive(tp->ecdev, skb->data, pkt_size); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
dev->last_rx = jiffies; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
tp->stats.rx_bytes += pkt_size; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
tp->stats.rx_packets++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
skb_put(skb, pkt_size); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
skb->protocol = eth_type_trans(skb, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
if (rtl8169_rx_vlan_skb(tp, desc, skb) < 0) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
rtl8169_rx_skb(skb); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
dev->last_rx = jiffies; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
tp->stats.rx_bytes += pkt_size; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
tp->stats.rx_packets++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
/* Work around for AMD plateform. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
if ((desc->opts2 & 0xfffe000) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
(tp->mac_version == RTL_GIGA_MAC_VER_05)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
desc->opts2 = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
cur_rx++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
count = cur_rx - tp->cur_rx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
tp->cur_rx = cur_rx; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
if (!delta && count && netif_msg_intr(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
tp->dirty_rx += delta; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
* FIXME: until there is periodic timer to try and refill the ring, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
* a temporary shortage may definitely kill the Rx process. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
* - disable the asic to try and avoid an overflow and kick it again |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
* after refill ? |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
* - how do others driver handle this condition (Uh oh...). |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
if ((tp->dirty_rx + NUM_RX_DESC == tp->cur_rx) && netif_msg_intr(tp)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
return count; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
struct net_device *dev = dev_instance; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
int boguscnt = max_interrupt_work; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
int status; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
int handled = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
do { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
if (tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
status = RTL_R16(IntrStatus); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
status = RTL_R16(IntrStatus); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
/* hotplug/major error/no more work/shared irq */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
if ((status == 0xFFFF) || !status) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
handled = 1; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
if (unlikely(!netif_running(dev))) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
rtl8169_asic_down(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
status &= tp->intr_mask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
RTL_W16(IntrStatus, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
(status & RxFIFOOver) ? (status | RxOverflow) : status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
if (!(status & tp->intr_event)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
/* Work around for rx fifo overflow */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
if (unlikely(status & RxFIFOOver) && |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
(tp->mac_version == RTL_GIGA_MAC_VER_11)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
netif_stop_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
rtl8169_tx_timeout(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
if (unlikely(status & SYSErr)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
rtl8169_pcierr_interrupt(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
if (status & LinkChg) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
rtl8169_check_link_status(dev, tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
#ifdef CONFIG_R8169_NAPI |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
if (status & tp->napi_event) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
tp->intr_mask = ~tp->napi_event; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
if (likely(netif_rx_schedule_prep(dev))) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
__netif_rx_schedule(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
else if (netif_msg_intr(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
printk(KERN_INFO "%s: interrupt %04x in poll\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
dev->name, status); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
break; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
#else |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
/* Rx interrupt */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
if (status & (RxOK | RxOverflow | RxFIFOOver)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
rtl8169_rx_interrupt(dev, tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
/* Tx interrupt */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
if (status & (TxOK | TxErr)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
rtl8169_tx_interrupt(dev, tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
boguscnt--; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
} while (boguscnt > 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
if (boguscnt <= 0) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
if (netif_msg_intr(tp) && net_ratelimit() ) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
printk(KERN_WARNING |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
"%s: Too much work at interrupt!\n", dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
/* Clear all interrupt sources. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
RTL_W16(IntrStatus, 0xffff); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
return IRQ_RETVAL(handled); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
#ifdef CONFIG_R8169_NAPI |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
static int rtl8169_poll(struct net_device *dev, int *budget) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
unsigned int work_done, work_to_do = min(*budget, dev->quota); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
work_done = rtl8169_rx_interrupt(dev, tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
rtl8169_tx_interrupt(dev, tp, ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
*budget -= work_done; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
dev->quota -= work_done; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
if (work_done < work_to_do) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
netif_rx_complete(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
tp->intr_mask = 0xffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
* 20040426: the barrier is not strictly required but the |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
* behavior of the irq handler could be less predictable |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
* without it. Btw, the lack of flush for the posted pci |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
* write is safe - FR |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
smp_wmb(); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
if(!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
RTL_W16(IntrMask, tp->intr_event); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
return (work_done >= work_to_do); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
static void rtl8169_down(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
unsigned int poll_locked = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
unsigned int intrmask; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
rtl8169_delete_timer(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
netif_stop_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
core_down: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
spin_lock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
rtl8169_asic_down(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
/* Update the error counts. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
tp->stats.rx_missed_errors += RTL_R32(RxMissed); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
RTL_W32(RxMissed, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
spin_unlock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
synchronize_irq(dev->irq); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
if (!poll_locked) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
netif_poll_disable(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
poll_locked++; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
/* Give a racing hard_start_xmit a few cycles to complete. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
/* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
* And now for the 50k$ question: are IRQ disabled or not ? |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
* Two paths lead here: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
* 1) dev->close |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
* -> netif_running() is available to sync the current code and the |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
* IRQ handler. See rtl8169_interrupt for details. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
* 2) dev->change_mtu |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
* -> rtl8169_poll can not be issued again and re-enable the |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
* interruptions. Let's simply issue the IRQ down sequence again. |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
* No loop if hotpluged or major error (0xffff). |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
intrmask = RTL_R16(IntrMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
if (intrmask && (intrmask != 0xffff)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
goto core_down; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
rtl8169_tx_clear(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
rtl8169_rx_clear(tp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3022 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
static int rtl8169_close(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
struct pci_dev *pdev = tp->pci_dev; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
rtl8169_down(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
free_irq(dev->irq, dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
netif_poll_enable(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
tp->RxPhyAddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
tp->TxPhyAddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
tp->TxDescArray = NULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
tp->RxDescArray = NULL; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
static void rtl_set_rx_mode(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
u32 mc_filter[2]; /* Multicast hash filter */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
int rx_mode; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
u32 tmp = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
if (dev->flags & IFF_PROMISC) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
/* Unconditionally log net taps. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
if (!tp->ecdev) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
if (netif_msg_link(tp)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
dev->name); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
rx_mode = |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
AcceptBroadcast | AcceptMulticast | AcceptMyPhys | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
AcceptAllPhys; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
mc_filter[1] = mc_filter[0] = 0xffffffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
} else if ((dev->mc_count > multicast_filter_limit) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
|| (dev->flags & IFF_ALLMULTI)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
/* Too many to filter perfectly -- accept all multicasts. */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
mc_filter[1] = mc_filter[0] = 0xffffffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
} else { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
struct dev_mc_list *mclist; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
unsigned int i; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
rx_mode = AcceptBroadcast | AcceptMyPhys; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
mc_filter[1] = mc_filter[0] = 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
i++, mclist = mclist->next) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
rx_mode |= AcceptMulticast; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
tmp = rtl8169_rx_config | rx_mode | |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
(RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
if ((tp->mac_version == RTL_GIGA_MAC_VER_11) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
(tp->mac_version == RTL_GIGA_MAC_VER_12) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
(tp->mac_version == RTL_GIGA_MAC_VER_13) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
(tp->mac_version == RTL_GIGA_MAC_VER_14) || |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
(tp->mac_version == RTL_GIGA_MAC_VER_15)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
mc_filter[0] = 0xffffffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
mc_filter[1] = 0xffffffff; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
RTL_W32(MAR0 + 0, mc_filter[0]); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
RTL_W32(MAR0 + 4, mc_filter[1]); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
RTL_W32(RxConfig, tmp); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
/** |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
* rtl8169_get_stats - Get rtl8169 read/write statistics |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
* @dev: The Ethernet Device to get statistics for |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
* |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
* Get TX/RX statistics for rtl8169 |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
*/ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
static struct net_device_stats *rtl8169_get_stats(struct net_device *dev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
unsigned long flags; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
if (netif_running(dev)) { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
spin_lock_irqsave(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
tp->stats.rx_missed_errors += RTL_R32(RxMissed); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
RTL_W32(RxMissed, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
spin_unlock_irqrestore(&tp->lock, flags); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
return &tp->stats; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
#ifdef CONFIG_PM |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
struct net_device *dev = pci_get_drvdata(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
struct rtl8169_private *tp = netdev_priv(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
void __iomem *ioaddr = tp->mmio_addr; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
if (!netif_running(dev)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
goto out_pci_suspend; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
netif_device_detach(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
netif_stop_queue(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
spin_lock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
rtl8169_asic_down(ioaddr); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
tp->stats.rx_missed_errors += RTL_R32(RxMissed); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
RTL_W32(RxMissed, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
spin_unlock_irq(&tp->lock); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
out_pci_suspend: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
pci_save_state(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
static int rtl8169_resume(struct pci_dev *pdev) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
struct net_device *dev = pci_get_drvdata(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
pci_set_power_state(pdev, PCI_D0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
pci_restore_state(pdev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
pci_enable_wake(pdev, PCI_D0, 0); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
if (!netif_running(dev)) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
goto out; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
netif_device_attach(dev); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
rtl8169_schedule_work(dev, rtl8169_reset_task); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
out: |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
return 0; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
#endif /* CONFIG_PM */ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
static struct pci_driver rtl8169_pci_driver = { |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
.name = MODULENAME, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
.id_table = rtl8169_pci_tbl, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
.probe = rtl8169_init_one, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
.remove = __devexit_p(rtl8169_remove_one), |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
#ifdef CONFIG_PM |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
.suspend = rtl8169_suspend, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
.resume = rtl8169_resume, |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
#endif |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
}; |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
static int __init rtl8169_init_module(void) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
return pci_register_driver(&rtl8169_pci_driver); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
static void __exit rtl8169_cleanup_module(void) |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
{ |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
pci_unregister_driver(&rtl8169_pci_driver); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
} |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
|
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
module_init(rtl8169_init_module); |
855c5d2d97f0
Added alpha support for the Realtek r8169 chipset, thanks to Scott
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
module_exit(rtl8169_cleanup_module); |