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.
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
24 #ifndef CONFIG_BFIN_EXTMEM_WRITEBACK
25 #define BFIN_MAC_CSUM_OFFLOAD
28 #define TX_RECLAIM_JIFFIES (HZ / 5)
30 struct dma_descriptor
{
31 struct dma_descriptor
*next_dma_desc
;
32 unsigned long start_addr
;
33 unsigned short config
;
34 unsigned short x_count
;
37 struct status_area_rx
{
38 #if defined(BFIN_MAC_CSUM_OFFLOAD)
39 unsigned short ip_hdr_csum
; /* ip header checksum */
40 /* ip payload(udp or tcp or others) checksum */
41 unsigned short ip_payload_csum
;
43 unsigned long status_word
; /* the frame status word */
46 struct status_area_tx
{
47 unsigned long status_word
; /* the frame status word */
50 /* use two descriptors for a packet */
51 struct net_dma_desc_rx
{
52 struct net_dma_desc_rx
*next
;
54 struct dma_descriptor desc_a
;
55 struct dma_descriptor desc_b
;
56 struct status_area_rx status
;
59 /* use two descriptors for a packet */
60 struct net_dma_desc_tx
{
61 struct net_dma_desc_tx
*next
;
63 struct dma_descriptor desc_a
;
64 struct dma_descriptor desc_b
;
65 unsigned char packet
[1560];
66 struct status_area_tx status
;
69 struct bfin_mac_local
{
71 * these are things that the kernel wants me to keep, so users
72 * can find out semi-useless statistics of how well the card is
75 struct net_device_stats stats
;
79 int wol
; /* Wake On Lan */
80 int irq_wake_requested
;
81 struct timer_list tx_reclaim_timer
;
82 struct net_device
*ndev
;
84 /* Data for EMAC_VLAN1 regs */
85 u16 vlan1_mask
, vlan2_mask
;
87 /* MII and PHY stuffs */
88 int old_link
; /* used by bf537_adjust_link */
92 struct phy_device
*phydev
;
93 struct mii_bus
*mii_bus
;
95 #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
99 struct hwtstamp_config stamp_cfg
;
100 struct ptp_clock_info caps
;
101 struct ptp_clock
*clock
;
103 spinlock_t phc_lock
; /* protects time lo/hi registers */
107 int bfin_get_ether_addr(char *addr
);