blob: 1ae7b82ceeee716b98c18f7f42d4cd6a6f8ccc74 [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 */
Barry Songfe92afe2010-05-17 17:19:40 -070010#ifndef _BFIN_MAC_H_
11#define _BFIN_MAC_H_
12
13#include <linux/net_tstamp.h>
14#include <linux/clocksource.h>
15#include <linux/timecompare.h>
Bryan Wue190d6b2007-07-17 14:43:44 +080016
Bryan Wue190d6b2007-07-17 14:43:44 +080017#define BFIN_MAC_CSUM_OFFLOAD
18
19struct dma_descriptor {
20 struct dma_descriptor *next_dma_desc;
21 unsigned long start_addr;
22 unsigned short config;
23 unsigned short x_count;
24};
25
26struct status_area_rx {
27#if defined(BFIN_MAC_CSUM_OFFLOAD)
28 unsigned short ip_hdr_csum; /* ip header checksum */
29 /* ip payload(udp or tcp or others) checksum */
30 unsigned short ip_payload_csum;
31#endif
32 unsigned long status_word; /* the frame status word */
33};
34
35struct status_area_tx {
36 unsigned long status_word; /* the frame status word */
37};
38
39/* use two descriptors for a packet */
40struct net_dma_desc_rx {
41 struct net_dma_desc_rx *next;
42 struct sk_buff *skb;
43 struct dma_descriptor desc_a;
44 struct dma_descriptor desc_b;
45 struct status_area_rx status;
46};
47
48/* use two descriptors for a packet */
49struct net_dma_desc_tx {
50 struct net_dma_desc_tx *next;
51 struct sk_buff *skb;
52 struct dma_descriptor desc_a;
53 struct dma_descriptor desc_b;
54 unsigned char packet[1560];
55 struct status_area_tx status;
56};
57
Bryan Wu7ef0a7e2008-04-25 11:53:10 +080058struct bfin_mac_local {
Bryan Wue190d6b2007-07-17 14:43:44 +080059 /*
60 * these are things that the kernel wants me to keep, so users
61 * can find out semi-useless statistics of how well the card is
62 * performing
63 */
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080064 struct net_device_stats stats;
Bryan Wue190d6b2007-07-17 14:43:44 +080065
Bryan Wue190d6b2007-07-17 14:43:44 +080066 unsigned char Mac[6]; /* MAC address of the board */
67 spinlock_t lock;
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080068
Michael Hennerich53fd3f22010-05-10 05:39:11 +000069 int wol; /* Wake On Lan */
70 int irq_wake_requested;
71
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080072 /* MII and PHY stuffs */
73 int old_link; /* used by bf537_adjust_link */
74 int old_speed;
75 int old_duplex;
76
77 struct phy_device *phydev;
Lennert Buytenhek298cf9b2008-10-08 16:29:57 -070078 struct mii_bus *mii_bus;
Barry Songfe92afe2010-05-17 17:19:40 -070079
80#if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
81 struct cyclecounter cycles;
82 struct timecounter clock;
83 struct timecompare compare;
84 struct hwtstamp_config stamp_cfg;
85#endif
Bryan Wue190d6b2007-07-17 14:43:44 +080086};
87
Mike Frysinger9862cc52007-11-15 21:21:20 +080088extern void bfin_get_ether_addr(char *addr);
Barry Songfe92afe2010-05-17 17:19:40 -070089
90#endif