blob: 04e4050df18b91fca21cf39880b654422f848b12 [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>
Sonic Zhang4fcc3d32010-06-11 17:44:31 +080016#include <linux/timer.h>
Bryan Wue190d6b2007-07-17 14:43:44 +080017
Bryan Wue190d6b2007-07-17 14:43:44 +080018#define BFIN_MAC_CSUM_OFFLOAD
19
Sonic Zhang4fcc3d32010-06-11 17:44:31 +080020#define TX_RECLAIM_JIFFIES (HZ / 5)
21
Bryan Wue190d6b2007-07-17 14:43:44 +080022struct dma_descriptor {
23 struct dma_descriptor *next_dma_desc;
24 unsigned long start_addr;
25 unsigned short config;
26 unsigned short x_count;
27};
28
29struct status_area_rx {
30#if defined(BFIN_MAC_CSUM_OFFLOAD)
31 unsigned short ip_hdr_csum; /* ip header checksum */
32 /* ip payload(udp or tcp or others) checksum */
33 unsigned short ip_payload_csum;
34#endif
35 unsigned long status_word; /* the frame status word */
36};
37
38struct status_area_tx {
39 unsigned long status_word; /* the frame status word */
40};
41
42/* use two descriptors for a packet */
43struct net_dma_desc_rx {
44 struct net_dma_desc_rx *next;
45 struct sk_buff *skb;
46 struct dma_descriptor desc_a;
47 struct dma_descriptor desc_b;
48 struct status_area_rx status;
49};
50
51/* use two descriptors for a packet */
52struct net_dma_desc_tx {
53 struct net_dma_desc_tx *next;
54 struct sk_buff *skb;
55 struct dma_descriptor desc_a;
56 struct dma_descriptor desc_b;
57 unsigned char packet[1560];
58 struct status_area_tx status;
59};
60
Bryan Wu7ef0a7e2008-04-25 11:53:10 +080061struct bfin_mac_local {
Bryan Wue190d6b2007-07-17 14:43:44 +080062 /*
63 * these are things that the kernel wants me to keep, so users
64 * can find out semi-useless statistics of how well the card is
65 * performing
66 */
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080067 struct net_device_stats stats;
Bryan Wue190d6b2007-07-17 14:43:44 +080068
Bryan Wue190d6b2007-07-17 14:43:44 +080069 unsigned char Mac[6]; /* MAC address of the board */
70 spinlock_t lock;
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080071
Michael Hennerich53fd3f22010-05-10 05:39:11 +000072 int wol; /* Wake On Lan */
73 int irq_wake_requested;
Sonic Zhang4fcc3d32010-06-11 17:44:31 +080074 struct timer_list tx_reclaim_timer;
75 struct net_device *ndev;
Michael Hennerich53fd3f22010-05-10 05:39:11 +000076
Bryan Wu4ae5a3a2007-09-19 23:37:36 +080077 /* MII and PHY stuffs */
78 int old_link; /* used by bf537_adjust_link */
79 int old_speed;
80 int old_duplex;
81
82 struct phy_device *phydev;
Lennert Buytenhek298cf9b2008-10-08 16:29:57 -070083 struct mii_bus *mii_bus;
Barry Songfe92afe2010-05-17 17:19:40 -070084
85#if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
86 struct cyclecounter cycles;
87 struct timecounter clock;
88 struct timecompare compare;
89 struct hwtstamp_config stamp_cfg;
90#endif
Bryan Wue190d6b2007-07-17 14:43:44 +080091};
92
Mike Frysinger9862cc52007-11-15 21:21:20 +080093extern void bfin_get_ether_addr(char *addr);
Barry Songfe92afe2010-05-17 17:19:40 -070094
95#endif