blob: 5970ea7142cd53c3e5f1d4234110a484f8af0191 [file] [log] [blame]
Bryan Wue190d6b2007-07-17 14:43:44 +08001/*
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
Bryan Wue190d6b2007-07-17 14:43:44 +080034#define BFIN_MAC_CSUM_OFFLOAD
35
36struct dma_descriptor {
37 struct dma_descriptor *next_dma_desc;
38 unsigned long start_addr;
39 unsigned short config;
40 unsigned short x_count;
41};
42
43struct status_area_rx {
44#if defined(BFIN_MAC_CSUM_OFFLOAD)
45 unsigned short ip_hdr_csum; /* ip header checksum */
46 /* ip payload(udp or tcp or others) checksum */
47 unsigned short ip_payload_csum;
48#endif
49 unsigned long status_word; /* the frame status word */
50};
51
52struct status_area_tx {
53 unsigned long status_word; /* the frame status word */
54};
55
56/* use two descriptors for a packet */
57struct net_dma_desc_rx {
58 struct net_dma_desc_rx *next;
59 struct sk_buff *skb;
60 struct dma_descriptor desc_a;
61 struct dma_descriptor desc_b;
62 struct status_area_rx status;
63};
64
65/* use two descriptors for a packet */
66struct net_dma_desc_tx {
67 struct net_dma_desc_tx *next;
68 struct sk_buff *skb;
69 struct dma_descriptor desc_a;
70 struct dma_descriptor desc_b;
71 unsigned char packet[1560];
72 struct status_area_tx status;
73};
74
75struct bf537mac_local {
76 /*
77 * these are things that the kernel wants me to keep, so users
78 * can find out semi-useless statistics of how well the card is
79 * performing
80 */
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080081 struct net_device_stats stats;
Bryan Wue190d6b2007-07-17 14:43:44 +080082
Bryan Wue190d6b2007-07-17 14:43:44 +080083 unsigned char Mac[6]; /* MAC address of the board */
84 spinlock_t lock;
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080085
86 /* MII and PHY stuffs */
87 int old_link; /* used by bf537_adjust_link */
88 int old_speed;
89 int old_duplex;
90
91 struct phy_device *phydev;
92 struct mii_bus mii_bus;
Bryan Wue190d6b2007-07-17 14:43:44 +080093};
94
Mike Frysinger9862cc52007-11-15 21:21:20 +080095extern void bfin_get_ether_addr(char *addr);