Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 1 | /* |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 2 | * Blackfin On-Chip MAC Driver |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 3 | * |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 4 | * Copyright 2004-2007 Analog Devices Inc. |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 5 | * |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 7 | * |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 8 | * Licensed under the GPL-2 or later. |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 9 | */ |
Barry Song | fe92afe | 2010-05-17 17:19:40 -0700 | [diff] [blame] | 10 | #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 Zhang | 4fcc3d3 | 2010-06-11 17:44:31 +0800 | [diff] [blame] | 16 | #include <linux/timer.h> |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 17 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 18 | #define BFIN_MAC_CSUM_OFFLOAD |
| 19 | |
Sonic Zhang | 4fcc3d3 | 2010-06-11 17:44:31 +0800 | [diff] [blame] | 20 | #define TX_RECLAIM_JIFFIES (HZ / 5) |
| 21 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 22 | struct 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 | |
| 29 | struct 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 | |
| 38 | struct status_area_tx { |
| 39 | unsigned long status_word; /* the frame status word */ |
| 40 | }; |
| 41 | |
| 42 | /* use two descriptors for a packet */ |
| 43 | struct 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 */ |
| 52 | struct 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 Wu | 7ef0a7e | 2008-04-25 11:53:10 +0800 | [diff] [blame] | 61 | struct bfin_mac_local { |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 62 | /* |
| 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 Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 67 | struct net_device_stats stats; |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 68 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 69 | unsigned char Mac[6]; /* MAC address of the board */ |
| 70 | spinlock_t lock; |
Bryan Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 71 | |
Michael Hennerich | 53fd3f2 | 2010-05-10 05:39:11 +0000 | [diff] [blame] | 72 | int wol; /* Wake On Lan */ |
| 73 | int irq_wake_requested; |
Sonic Zhang | 4fcc3d3 | 2010-06-11 17:44:31 +0800 | [diff] [blame] | 74 | struct timer_list tx_reclaim_timer; |
| 75 | struct net_device *ndev; |
Michael Hennerich | 53fd3f2 | 2010-05-10 05:39:11 +0000 | [diff] [blame] | 76 | |
Bryan Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 77 | /* 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 Buytenhek | 298cf9be | 2008-10-08 16:29:57 -0700 | [diff] [blame] | 83 | struct mii_bus *mii_bus; |
Barry Song | fe92afe | 2010-05-17 17:19:40 -0700 | [diff] [blame] | 84 | |
| 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 Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 91 | }; |
| 92 | |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 93 | extern void bfin_get_ether_addr(char *addr); |
Barry Song | fe92afe | 2010-05-17 17:19:40 -0700 | [diff] [blame] | 94 | |
| 95 | #endif |