aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1e
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/net/atl1e
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'drivers/net/atl1e')
-rw-r--r--drivers/net/atl1e/Makefile2
-rw-r--r--drivers/net/atl1e/atl1e.h509
-rw-r--r--drivers/net/atl1e/atl1e_ethtool.c390
-rw-r--r--drivers/net/atl1e/atl1e_hw.c651
-rw-r--r--drivers/net/atl1e/atl1e_hw.h690
-rw-r--r--drivers/net/atl1e/atl1e_main.c2558
-rw-r--r--drivers/net/atl1e/atl1e_param.c268
7 files changed, 5068 insertions, 0 deletions
diff --git a/drivers/net/atl1e/Makefile b/drivers/net/atl1e/Makefile
new file mode 100644
index 00000000000..bc11be824e7
--- /dev/null
+++ b/drivers/net/atl1e/Makefile
@@ -0,0 +1,2 @@
1obj-$(CONFIG_ATL1E) += atl1e.o
2atl1e-objs += atl1e_main.o atl1e_hw.o atl1e_ethtool.o atl1e_param.o
diff --git a/drivers/net/atl1e/atl1e.h b/drivers/net/atl1e/atl1e.h
new file mode 100644
index 00000000000..829b5ad71d0
--- /dev/null
+++ b/drivers/net/atl1e/atl1e.h
@@ -0,0 +1,509 @@
1/*
2 * Copyright(c) 2007 Atheros Corporation. All rights reserved.
3 * Copyright(c) 2007 xiong huang <xiong.huang@atheros.com>
4 *
5 * Derived from Intel e1000 driver
6 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program; if not, write to the Free Software Foundation, Inc., 59
20 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23#ifndef _ATL1E_H_
24#define _ATL1E_H_
25
26#include <linux/init.h>
27#include <linux/interrupt.h>
28#include <linux/types.h>
29#include <linux/errno.h>
30#include <linux/module.h>
31#include <linux/pci.h>
32#include <linux/netdevice.h>
33#include <linux/etherdevice.h>
34#include <linux/skbuff.h>
35#include <linux/ioport.h>
36#include <linux/slab.h>
37#include <linux/list.h>
38#include <linux/delay.h>
39#include <linux/sched.h>
40#include <linux/in.h>
41#include <linux/ip.h>
42#include <linux/ipv6.h>
43#include <linux/udp.h>
44#include <linux/mii.h>
45#include <linux/io.h>
46#include <linux/vmalloc.h>
47#include <linux/pagemap.h>
48#include <linux/tcp.h>
49#include <linux/ethtool.h>
50#include <linux/if_vlan.h>
51#include <linux/workqueue.h>
52#include <net/checksum.h>
53#include <net/ip6_checksum.h>
54
55#include "atl1e_hw.h"
56
57#define PCI_REG_COMMAND 0x04 /* PCI Command Register */
58#define CMD_IO_SPACE 0x0001
59#define CMD_MEMORY_SPACE 0x0002
60#define CMD_BUS_MASTER 0x0004
61
62#define BAR_0 0
63#define BAR_1 1
64#define BAR_5 5
65
66/* Wake Up Filter Control */
67#define AT_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
68#define AT_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
69#define AT_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
70#define AT_WUFC_MC 0x00000008 /* Multicast Wakeup Enable */
71#define AT_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
72
73#define SPEED_0 0xffff
74#define HALF_DUPLEX 1
75#define FULL_DUPLEX 2
76
77/* Error Codes */
78#define AT_ERR_EEPROM 1
79#define AT_ERR_PHY 2
80#define AT_ERR_CONFIG 3
81#define AT_ERR_PARAM 4
82#define AT_ERR_MAC_TYPE 5
83#define AT_ERR_PHY_TYPE 6
84#define AT_ERR_PHY_SPEED 7
85#define AT_ERR_PHY_RES 8
86#define AT_ERR_TIMEOUT 9
87
88#define MAX_JUMBO_FRAME_SIZE 0x2000
89
90#define AT_VLAN_TAG_TO_TPD_TAG(_vlan, _tpd) \
91 _tpd = (((_vlan) << (4)) | (((_vlan) >> 13) & 7) |\
92 (((_vlan) >> 9) & 8))
93
94#define AT_TPD_TAG_TO_VLAN_TAG(_tpd, _vlan) \
95 _vlan = (((_tpd) >> 8) | (((_tpd) & 0x77) << 9) |\
96 (((_tdp) & 0x88) << 5))
97
98#define AT_MAX_RECEIVE_QUEUE 4
99#define AT_PAGE_NUM_PER_QUEUE 2
100
101#define AT_DMA_HI_ADDR_MASK 0xffffffff00000000ULL
102#define AT_DMA_LO_ADDR_MASK 0x00000000ffffffffULL
103
104#define AT_TX_WATCHDOG (5 * HZ)
105#define AT_MAX_INT_WORK 10
106#define AT_TWSI_EEPROM_TIMEOUT 100
107#define AT_HW_MAX_IDLE_DELAY 10
108#define AT_SUSPEND_LINK_TIMEOUT 28
109
110#define AT_REGS_LEN 75
111#define AT_EEPROM_LEN 512
112#define AT_ADV_MASK (ADVERTISE_10_HALF |\
113 ADVERTISE_10_FULL |\
114 ADVERTISE_100_HALF |\
115 ADVERTISE_100_FULL |\
116 ADVERTISE_1000_FULL)
117
118/* tpd word 2 */
119#define TPD_BUFLEN_MASK 0x3FFF
120#define TPD_BUFLEN_SHIFT 0
121#define TPD_DMAINT_MASK 0x0001
122#define TPD_DMAINT_SHIFT 14
123#define TPD_PKTNT_MASK 0x0001
124#define TPD_PKTINT_SHIFT 15
125#define TPD_VLANTAG_MASK 0xFFFF
126#define TPD_VLAN_SHIFT 16
127
128/* tpd word 3 bits 0:4 */
129#define TPD_EOP_MASK 0x0001
130#define TPD_EOP_SHIFT 0
131#define TPD_IP_VERSION_MASK 0x0001
132#define TPD_IP_VERSION_SHIFT 1 /* 0 : IPV4, 1 : IPV6 */
133#define TPD_INS_VL_TAG_MASK 0x0001
134#define TPD_INS_VL_TAG_SHIFT 2
135#define TPD_CC_SEGMENT_EN_MASK 0x0001
136#define TPD_CC_SEGMENT_EN_SHIFT 3
137#define TPD_SEGMENT_EN_MASK 0x0001
138#define TPD_SEGMENT_EN_SHIFT 4
139
140/* tdp word 3 bits 5:7 if ip version is 0 */
141#define TPD_IP_CSUM_MASK 0x0001
142#define TPD_IP_CSUM_SHIFT 5
143#define TPD_TCP_CSUM_MASK 0x0001
144#define TPD_TCP_CSUM_SHIFT 6
145#define TPD_UDP_CSUM_MASK 0x0001
146#define TPD_UDP_CSUM_SHIFT 7
147
148/* tdp word 3 bits 5:7 if ip version is 1 */
149#define TPD_V6_IPHLLO_MASK 0x0007
150#define TPD_V6_IPHLLO_SHIFT 7
151
152/* tpd word 3 bits 8:9 bit */
153#define TPD_VL_TAGGED_MASK 0x0001
154#define TPD_VL_TAGGED_SHIFT 8
155#define TPD_ETHTYPE_MASK 0x0001
156#define TPD_ETHTYPE_SHIFT 9
157
158/* tdp word 3 bits 10:13 if ip version is 0 */
159#define TDP_V4_IPHL_MASK 0x000F
160#define TPD_V4_IPHL_SHIFT 10
161
162/* tdp word 3 bits 10:13 if ip version is 1 */
163#define TPD_V6_IPHLHI_MASK 0x000F
164#define TPD_V6_IPHLHI_SHIFT 10
165
166/* tpd word 3 bit 14:31 if segment enabled */
167#define TPD_TCPHDRLEN_MASK 0x000F
168#define TPD_TCPHDRLEN_SHIFT 14
169#define TPD_HDRFLAG_MASK 0x0001
170#define TPD_HDRFLAG_SHIFT 18
171#define TPD_MSS_MASK 0x1FFF
172#define TPD_MSS_SHIFT 19
173
174/* tdp word 3 bit 16:31 if custom csum enabled */
175#define TPD_PLOADOFFSET_MASK 0x00FF
176#define TPD_PLOADOFFSET_SHIFT 16
177#define TPD_CCSUMOFFSET_MASK 0x00FF
178#define TPD_CCSUMOFFSET_SHIFT 24
179
180struct atl1e_tpd_desc {
181 __le64 buffer_addr;
182 __le32 word2;
183 __le32 word3;
184};
185
186/* how about 0x2000 */
187#define MAX_TX_BUF_LEN 0x2000
188#define MAX_TX_BUF_SHIFT 13
189/*#define MAX_TX_BUF_LEN 0x3000 */
190
191/* rrs word 1 bit 0:31 */
192#define RRS_RX_CSUM_MASK 0xFFFF
193#define RRS_RX_CSUM_SHIFT 0
194#define RRS_PKT_SIZE_MASK 0x3FFF
195#define RRS_PKT_SIZE_SHIFT 16
196#define RRS_CPU_NUM_MASK 0x0003
197#define RRS_CPU_NUM_SHIFT 30
198
199#define RRS_IS_RSS_IPV4 0x0001
200#define RRS_IS_RSS_IPV4_TCP 0x0002
201#define RRS_IS_RSS_IPV6 0x0004
202#define RRS_IS_RSS_IPV6_TCP 0x0008
203#define RRS_IS_IPV6 0x0010
204#define RRS_IS_IP_FRAG 0x0020