57f042c3111ca58b042b22ac87b07c0e151d9605
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / net / ethernet / adi / bfin_mac.h
1 /*
2  * Blackfin On-Chip MAC Driver
3  *
4  * Copyright 2004-2007 Analog Devices Inc.
5  *
6  * Enter bugs at http://blackfin.uclinux.org/
7  *
8  * Licensed under the GPL-2 or later.
9  */
10 #ifndef _BFIN_MAC_H_
11 #define _BFIN_MAC_H_
12
13 #include <linux/net_tstamp.h>
14 #include <linux/timer.h>
15 #include <linux/etherdevice.h>
16 #include <linux/bfin_mac.h>
17
18 /*
19  * Disable hardware checksum for bug #5600 if writeback cache is
20  * enabled. Otherwize, corrupted RX packet will be sent up stack
21  * without error mark.
22  */
23 #ifndef CONFIG_BFIN_EXTMEM_WRITEBACK
24 #define BFIN_MAC_CSUM_OFFLOAD
25 #endif
26
27 #define TX_RECLAIM_JIFFIES (HZ / 5)
28
29 struct dma_descriptor {
30         struct dma_descriptor *next_dma_desc;
31         unsigned long start_addr;
32         unsigned short config;
33         unsigned short x_count;
34 };
35
36 struct status_area_rx {
37 #if defined(BFIN_MAC_CSUM_OFFLOAD)
38         unsigned short ip_hdr_csum;     /* ip header checksum */
39         /* ip payload(udp or tcp or others) checksum */
40         unsigned short ip_payload_csum;
41 #endif
42         unsigned long status_word;      /* the frame status word */
43 };
44
45 struct status_area_tx {
46         unsigned long status_word;      /* the frame status word */
47 };
48
49 /* use two descriptors for a packet */
50 struct net_dma_desc_rx {
51         struct net_dma_desc_rx *next;
52         struct sk_buff *skb;
53         struct dma_descriptor desc_a;
54         struct dma_descriptor desc_b;
55         struct status_area_rx status;
56 };
57
58 /* use two descriptors for a packet */
59 struct net_dma_desc_tx {
60         struct net_dma_desc_tx *next;
61         struct sk_buff *skb;
62         struct dma_descriptor desc_a;
63         struct dma_descriptor desc_b;
64         unsigned char packet[1560];
65         struct status_area_tx status;
66 };
67
68 struct bfin_mac_local {
69         /*
70          * these are things that the kernel wants me to keep, so users
71          * can find out semi-useless statistics of how well the card is
72          * performing
73          */
74         struct net_device_stats stats;
75
76         spinlock_t lock;
77
78         int wol;                /* Wake On Lan */
79         int irq_wake_requested;
80         struct timer_list tx_reclaim_timer;
81         struct net_device *ndev;
82
83         /* Data for EMAC_VLAN1 regs */
84         u16 vlan1_mask, vlan2_mask;
85
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;
93
94 #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
95         u32 addend;
96         unsigned int shift;
97         struct hwtstamp_config stamp_cfg;
98 #endif
99 };
100
101 extern int bfin_get_ether_addr(char *addr);
102
103 #endif