aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bfin_mac.h
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@analog.com>2007-07-17 02:43:44 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-18 18:38:25 -0400
commite190d6b140079c104ba57e5130a9b4ebea618e92 (patch)
tree9c7230ac7520ac1a4afe7903f8d212951643e67d /drivers/net/bfin_mac.h
parent308a90683da9a3e3da1023a88496f76f95c5dcd8 (diff)
Blackfin ethernet driver: on chip ethernet MAC controller driver
This patch implements the driver necessary use the Analog Devices Blackfin processor's on-chip ethernet MAC controller. [try#2] - add timeout control - kill dma_config_reg bitfields - some trivial cleanup [try#3] - add endianess check - add DRV_NAME, DRV_VERSION... driver information string - add some comments for silicon anomaly and dma API confusion - some code trivial cleanup [try#4] - add Blackfin latest GPIO pin mux opertion with Michael Hennerich's help and Dan's review - rewrite the DMA descriptor list operation in a more readable way by Joe's review [try#5] - cleanup some coding style by Joe's review. [try#6] - 1.1 version fix a bug when set up multicast list pointed by Mr. yoshfuji - rearrange the desc_list_free function. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Cc: Michael Buesch <mb@bu3sch.de> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Dan Williams <dcbw@redhat.com> Cc: Joe Perches <joe@perches.com> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bfin_mac.h')
-rw-r--r--drivers/net/bfin_mac.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h
new file mode 100644
index 000000000000..af87189b85fa
--- /dev/null
+++ b/drivers/net/bfin_mac.h
@@ -0,0 +1,132 @@
1/*
2 * File: drivers/net/bfin_mac.c
3 * Based on:
4 * Maintainer:
5 * Bryan Wu <bryan.wu@analog.com>
6 *
7 * Original author:
8 * Luke Yang <luke.yang@analog.com>
9 *
10 * Created:
11 * Description:
12 *
13 * Modified:
14 * Copyright 2004-2006 Analog Devices Inc.
15 *
16 * Bugs: Enter bugs at http://blackfin.uclinux.org/
17 *
18 * This program is free software ; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation ; either version 2, or (at your option)
21 * any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY ; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program ; see the file COPYING.
30 * If not, write to the Free Software Foundation,
31 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 */
33
34/*
35 * PHY REGISTER NAMES
36 */
37#define PHYREG_MODECTL 0x0000
38#define PHYREG_MODESTAT 0x0001
39#define PHYREG_PHYID1 0x0002
40#define PHYREG_PHYID2 0x0003
41#define PHYREG_ANAR 0x0004
42#define PHYREG_ANLPAR 0x0005
43#define PHYREG_ANER 0x0006
44#define PHYREG_NSR 0x0010
45#define PHYREG_LBREMR 0x0011
46#define PHYREG_REC 0x0012
47#define PHYREG_10CFG 0x0013
48#define PHYREG_PHY1_1 0x0014
49#define PHYREG_PHY1_2 0x0015
50#define PHYREG_PHY2 0x0016
51#define PHYREG_TW_1 0x0017
52#define PHYREG_TW_2 0x0018
53#define PHYREG_TEST 0x0019
54
55#define PHY_RESET 0x8000
56#define PHY_ANEG_EN 0x1000
57#define PHY_DUPLEX 0x0100
58#define PHY_SPD_SET 0x2000
59
60#define BFIN_MAC_CSUM_OFFLOAD
61
62struct dma_descriptor {
63 struct dma_descriptor *next_dma_desc;
64 unsigned long start_addr;
65 unsigned short config;
66 unsigned short x_count;
67};
68
69struct status_area_rx {
70#if defined(BFIN_MAC_CSUM_OFFLOAD)
71 unsigned short ip_hdr_csum; /* ip header checksum */
72 /* ip payload(udp or tcp or others) checksum */
73 unsigned short ip_payload_csum;
74#endif
75 unsigned long status_word; /* the frame status word */
76};
77
78struct status_area_tx {
79 unsigned long status_word; /* the frame status word */
80};
81
82/* use two descriptors for a packet */
83struct net_dma_desc_rx {
84 struct net_dma_desc_rx *next;
85 struct sk_buff *skb;
86 struct dma_descriptor desc_a;
87 struct dma_descriptor desc_b;
88 struct status_area_rx status;
89};
90
91/* use two descriptors for a packet */
92struct net_dma_desc_tx {
93 struct net_dma_desc_tx *next;
94 struct sk_buff *skb;
95 struct dma_descriptor desc_a;
96 struct dma_descriptor desc_b;
97 unsigned char packet[1560];
98 struct status_area_tx status;
99};
100
101struct bf537mac_local {
102 /*
103 * these are things that the kernel wants me to keep, so users
104 * can find out semi-useless statistics of how well the card is
105 * performing
106 */
107 struct net_device_stats stats;
108
109 int version;
110
111 int FlowEnabled; /* record if data flow is active */
112 int EtherIntIVG; /* IVG for the ethernet interrupt */
113 int RXIVG; /* IVG for the RX completion */
114 int TXIVG; /* IVG for the TX completion */
115 int PhyAddr; /* PHY address */
116 int OpMode; /* set these bits n the OPMODE regs */
117 int Port10; /* set port speed to 10 Mbit/s */
118 int GenChksums; /* IP checksums to be calculated */
119 int NoRcveLnth; /* dont insert recv length at start of buffer */
120 int StripPads; /* remove trailing pad bytes */
121 int FullDuplex; /* set full duplex mode */
122 int Negotiate; /* enable auto negotiation */
123 int Loopback; /* loopback at the PHY */
124 int Cache; /* Buffers may be cached */
125 int FlowControl; /* flow control active */
126 int CLKIN; /* clock in value in MHZ */
127 unsigned short IntMask; /* interrupt mask */
128 unsigned char Mac[6]; /* MAC address of the board */
129 spinlock_t lock;
130};
131
132extern void get_bf537_ether_addr(char *addr);