blob: 052b5dce3e3c8a865c2d351d86450dc2976fd3c2 [file] [log] [blame]
Bryan Wue190d6b2007-07-17 14:43:44 +08001/*
Mike Frysinger2fb9d6f2008-01-30 16:52:24 +08002 * Blackfin On-Chip MAC Driver
Bryan Wue190d6b2007-07-17 14:43:44 +08003 *
Mike Frysinger2fb9d6f2008-01-30 16:52:24 +08004 * Copyright 2004-2007 Analog Devices Inc.
Bryan Wue190d6b2007-07-17 14:43:44 +08005 *
Mike Frysinger2fb9d6f2008-01-30 16:52:24 +08006 * Enter bugs at http://blackfin.uclinux.org/
Bryan Wue190d6b2007-07-17 14:43:44 +08007 *
Mike Frysinger2fb9d6f2008-01-30 16:52:24 +08008 * Licensed under the GPL-2 or later.
Bryan Wue190d6b2007-07-17 14:43:44 +08009 */
10
Bryan Wue190d6b2007-07-17 14:43:44 +080011#define BFIN_MAC_CSUM_OFFLOAD
12
13struct dma_descriptor {
14 struct dma_descriptor *next_dma_desc;
15 unsigned long start_addr;
16 unsigned short config;
17 unsigned short x_count;
18};
19
20struct status_area_rx {
21#if defined(BFIN_MAC_CSUM_OFFLOAD)
22 unsigned short ip_hdr_csum; /* ip header checksum */
23 /* ip payload(udp or tcp or others) checksum */
24 unsigned short ip_payload_csum;
25#endif
26 unsigned long status_word; /* the frame status word */
27};
28
29struct status_area_tx {
30 unsigned long status_word; /* the frame status word */
31};
32
33/* use two descriptors for a packet */
34struct net_dma_desc_rx {
35 struct net_dma_desc_rx *next;
36 struct sk_buff *skb;
37 struct dma_descriptor desc_a;
38 struct dma_descriptor desc_b;
39 struct status_area_rx status;
40};
41
42/* use two descriptors for a packet */
43struct net_dma_desc_tx {
44 struct net_dma_desc_tx *next;
45 struct sk_buff *skb;
46 struct dma_descriptor desc_a;
47 struct dma_descriptor desc_b;
48 unsigned char packet[1560];
49 struct status_area_tx status;
50};
51
Bryan Wu7ef0a7e2008-04-25 11:53:10 +080052struct bfin_mac_local {
Bryan Wue190d6b2007-07-17 14:43:44 +080053 /*
54 * these are things that the kernel wants me to keep, so users
55 * can find out semi-useless statistics of how well the card is
56 * performing
57 */
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080058 struct net_device_stats stats;
Bryan Wue190d6b2007-07-17 14:43:44 +080059
Bryan Wue190d6b2007-07-17 14:43:44 +080060 unsigned char Mac[6]; /* MAC address of the board */
61 spinlock_t lock;
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080062
63 /* MII and PHY stuffs */
64 int old_link; /* used by bf537_adjust_link */
65 int old_speed;
66 int old_duplex;
67
68 struct phy_device *phydev;
Lennert Buytenhek298cf9b2008-10-08 16:29:57 -070069 struct mii_bus *mii_bus;
Bryan Wue190d6b2007-07-17 14:43:44 +080070};
71
Mike Frysinger9862cc52007-11-15 21:21:20 +080072extern void bfin_get_ether_addr(char *addr);