Linux 4.16.11
[linux/fpc-iii.git] / drivers / net / ethernet / adi / bfin_mac.h
blob4ad5b9be3f84c52b9e04f6919431c198a6d5a011
1 /*
2 * Blackfin On-Chip MAC Driver
4 * Copyright 2004-2007 Analog Devices Inc.
6 * Enter bugs at http://blackfin.uclinux.org/
8 * Licensed under the GPL-2 or later.
9 */
10 #ifndef _BFIN_MAC_H_
11 #define _BFIN_MAC_H_
13 #include <linux/net_tstamp.h>
14 #include <linux/ptp_clock_kernel.h>
15 #include <linux/timer.h>
16 #include <linux/etherdevice.h>
17 #include <linux/bfin_mac.h>
20 * Disable hardware checksum for bug #5600 if writeback cache is
21 * enabled. Otherwize, corrupted RX packet will be sent up stack
22 * without error mark.
24 #ifndef CONFIG_BFIN_EXTMEM_WRITEBACK
25 #define BFIN_MAC_CSUM_OFFLOAD
26 #endif
28 #define TX_RECLAIM_JIFFIES (HZ / 5)
29 #define BFIN_MAC_RX_IRQ_DISABLED 1
31 struct dma_descriptor {
32 struct dma_descriptor *next_dma_desc;
33 unsigned long start_addr;
34 unsigned short config;
35 unsigned short x_count;
38 struct status_area_rx {
39 #if defined(BFIN_MAC_CSUM_OFFLOAD)
40 unsigned short ip_hdr_csum; /* ip header checksum */
41 /* ip payload(udp or tcp or others) checksum */
42 unsigned short ip_payload_csum;
43 #endif
44 unsigned long status_word; /* the frame status word */
47 struct status_area_tx {
48 unsigned long status_word; /* the frame status word */
51 /* use two descriptors for a packet */
52 struct net_dma_desc_rx {
53 struct net_dma_desc_rx *next;
54 struct sk_buff *skb;
55 struct dma_descriptor desc_a;
56 struct dma_descriptor desc_b;
57 struct status_area_rx status;
60 /* use two descriptors for a packet */
61 struct net_dma_desc_tx {
62 struct net_dma_desc_tx *next;
63 struct sk_buff *skb;
64 struct dma_descriptor desc_a;
65 struct dma_descriptor desc_b;
66 unsigned char packet[1560];
67 struct status_area_tx status;
70 struct bfin_mac_local {
71 spinlock_t lock;
73 int wol; /* Wake On Lan */
74 int irq_wake_requested;
75 struct timer_list tx_reclaim_timer;
76 struct net_device *ndev;
77 struct napi_struct napi;
78 unsigned long flags;
80 /* Data for EMAC_VLAN1 regs */
81 u16 vlan1_mask, vlan2_mask;
83 /* MII and PHY stuffs */
84 int old_link; /* used by bf537_adjust_link */
85 int old_speed;
86 int old_duplex;
88 struct mii_bus *mii_bus;
90 #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
91 u32 addend;
92 unsigned int shift;
93 s32 max_ppb;
94 struct hwtstamp_config stamp_cfg;
95 struct ptp_clock_info caps;
96 struct ptp_clock *clock;
97 int phc_index;
98 spinlock_t phc_lock; /* protects time lo/hi registers */
99 #endif
102 int bfin_get_ether_addr(char *addr);
104 #endif